VARIABLE SCOPES

#!/usr/bin/env python3.0
#
#       variable_scopes.py
#       
#       
# Example of variable scopes
 
 
def localExample():
    number1 = 123
    print ("This is local scope. Number",number1)
 
def globalExample():
    global number2
    number2 += 100
 
 
localExample()
 
number2 = 999
print('variable value:', number2)
globalExample()
print('variable value after globalExample() call:', number2)

 
python/py3scopes.txt · Last modified: 2011/11/25 10:45 (external edit)
Email address
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki