You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/prodigiouspython/Chapter_1/10_String_representations_of_objects.html
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -501,8 +501,8 @@ <h1><span class="section-number">10. </span>String representations of objects: s
501
501
</div>
502
502
</div>
503
503
<divclass="cell_output docutils container">
504
-
<divclass="output stream highlight-myst-ansi notranslate"><divclass="highlight"><pre><span></span>The repr of now is: datetime.datetime(2023, 9, 4, 15, 9, 3, 655082)
505
-
The str of now is: 2023-09-04 15:09:03.655082
504
+
<divclass="output stream highlight-myst-ansi notranslate"><divclass="highlight"><pre><span></span>The repr of now is: datetime.datetime(2023, 9, 5, 20, 5, 22, 200371)
505
+
The str of now is: 2023-09-05 20:05:22.200371
506
506
</pre></div>
507
507
</div>
508
508
</div>
@@ -521,8 +521,8 @@ <h1><span class="section-number">10. </span>String representations of objects: s
521
521
</div>
522
522
</div>
523
523
<divclass="cell_output docutils container">
524
-
<divclass="output stream highlight-myst-ansi notranslate"><divclass="highlight"><pre><span></span>The repr of language_obj is: <__main__.ProgrammingLanguage object at 0x7f8eee7553d0>
525
-
The str of language_obj is: <__main__.ProgrammingLanguage object at 0x7f8eee7553d0>
524
+
<divclass="output stream highlight-myst-ansi notranslate"><divclass="highlight"><pre><span></span>The repr of language_obj is: <__main__.ProgrammingLanguage object at 0x7f66345afd50>
525
+
The str of language_obj is: <__main__.ProgrammingLanguage object at 0x7f66345afd50>
526
526
</pre></div>
527
527
</div>
528
528
</div>
@@ -552,7 +552,7 @@ <h1><span class="section-number">10. </span>String representations of objects: s
552
552
</div>
553
553
</div>
554
554
<divclass="cell_output docutils container">
555
-
<divclass="output stream highlight-myst-ansi notranslate"><divclass="highlight"><pre><span></span>The repr of human_obj is: Human(name=IronMan, age=48) object at 0x7f8eee754250
555
+
<divclass="output stream highlight-myst-ansi notranslate"><divclass="highlight"><pre><span></span>The repr of human_obj is: Human(name=IronMan, age=48) object at 0x7f66345ca690
<spanclass="nb">print</span><spanclass="p">(</span><spanclass="sa">f</span><spanclass="s2">"There is no environment variable named </span><spanclass="si">{</span><spanclass="n">new_environment_variable_name</span><spanclass="si">}</span><spanclass="s2">"</span><spanclass="p">)</span>
576
576
<spanclass="k">else</span><spanclass="p">:</span>
577
-
<spanclass="nb">print</span><spanclass="p">(</span><spanclass="sa">f</span><spanclass="s2">"The value assigned for the environment variable named </span><spanclass="si">{</span><spanclass="n">new_environment_variable_name</span><spanclass="si">}</span><spanclass="s2"> is </span><spanclass="si">{</span><spanclass="n">value</span><spanclass="si">}</span><spanclass="s2">"</span><spanclass="p">)</span>
<spanclass="sa">f</span><spanclass="s2">"The value assigned for the environment variable named </span><spanclass="si">{</span><spanclass="n">new_environment_variable_name</span><spanclass="si">}</span><spanclass="s2"> is </span><spanclass="si">{</span><spanclass="n">value</span><spanclass="si">}</span><spanclass="s2">"</span>
<spanclass="c1"># We can get the values by index.</span>
759
-
<spanclass="nb">print</span><spanclass="p">(</span><spanclass="sa">f</span><spanclass="s2">"</span><spanclass="si">{</span><spanclass="n">language_initial_release_year</span><spanclass="p">[</span><spanclass="mi">0</span><spanclass="p">]</span><spanclass="si">}</span><spanclass="s2"> is released in </span><spanclass="si">{</span><spanclass="n">language_initial_release_year</span><spanclass="p">[</span><spanclass="mi">1</span><spanclass="p">]</span><spanclass="si">}</span><spanclass="s2">"</span><spanclass="p">)</span>
<spanclass="sa">f</span><spanclass="s2">"</span><spanclass="si">{</span><spanclass="n">language_initial_release_year</span><spanclass="p">[</span><spanclass="mi">0</span><spanclass="p">]</span><spanclass="si">}</span><spanclass="s2"> is released in </span><spanclass="si">{</span><spanclass="n">language_initial_release_year</span><spanclass="p">[</span><spanclass="mi">1</span><spanclass="p">]</span><spanclass="si">}</span><spanclass="s2">"</span>
Copy file name to clipboardExpand all lines: docs/prodigiouspython/Chapter_1/5_Collection_Types.html
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -745,7 +745,9 @@ <h3><span class="section-number">5.2.1. </span>We have a few methods of list tha
745
745
<spanclass="c1"># When index argument is passed, it would remove and return the element at that index.</span>
746
746
<spanclass="c1"># raises IndexError when no object is present at the given Index.</span>
747
747
<spanclass="k">try</span><spanclass="p">:</span>
748
-
<spanclass="n">last_element</span><spanclass="o">=</span><spanclass="n">my_list</span><spanclass="o">.</span><spanclass="n">pop</span><spanclass="p">()</span><spanclass="c1"># can be passed index argument value, if required to pop at a specific index.</span>
<spanclass="nb">print</span><spanclass="p">(</span><spanclass="sa">f</span><spanclass="s2">"Caught KeyError as there's given anime series present in the anime set: </span><spanclass="si">{</span><spanclass="n">exc</span><spanclass="si">}</span><spanclass="s2">"</span><spanclass="p">)</span>
<spanclass="sa">f</span><spanclass="s2">"Caught KeyError as there's given anime series present in the anime set: </span><spanclass="si">{</span><spanclass="n">exc</span><spanclass="si">}</span><spanclass="s2">"</span>
<spanclass="nb">print</span><spanclass="p">(</span><spanclass="sa">f</span><spanclass="s2">"👻 Ouch, KeyError has been raised as no given key is found in the dictionary: </span><spanclass="si">{</span><spanclass="n">exc</span><spanclass="si">}</span><spanclass="s2">"</span><spanclass="p">)</span>
<spanclass="sa">f</span><spanclass="s2">"👻 Ouch, KeyError has been raised as no given key is found in the dictionary: </span><spanclass="si">{</span><spanclass="n">exc</span><spanclass="si">}</span><spanclass="s2">"</span>
0 commit comments