Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 7

243 bytes added, 11:54, 3 December 2017
LAB 7 SIGN-OFF (SHOW INSTRUCTOR)
Note that the function1() call does not modify the global '''authorName''' variable but function2() does.
 
As an exercise: modify the example above so that it would print the following, by changing only the scope of some variables. Save the program as '''lab7c.py''':
 
<source>
Andrew
Andrew 1
Andrew 1
Andrew 2
Andrew 1
</source>
== Object/Instance Scope ==
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Output of: <code>./CheckLab7.py -f -v</code>
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Output of: <code>cat lab7a.py lab7b.py lab7c.py</code>
= LAB REVIEW =