Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Using Global and Local variables in the same code

x = "global "

def foo():
    global x
    y = "local"
    x = x * 2
    print(x)
    print(y)

foo()
 
PREVIOUS NEXT
Tagged: #Python #Using #Global #Local #variables #code
ADD COMMENT
Topic
Name
6+2 =