Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Global variable and Local variable with same name

x = 5

def foo():
    x = 10
    print("local x:", x)


foo()
print("global x:", x)
 
PREVIOUS NEXT
Tagged: #Python #Global #variable #Local #variable
ADD COMMENT
Topic
Name
2+7 =