Understanding scope
What four values does this script print?
x = 50
def one():
x = 10
def two():
global x
x = 30
def three():
x = 100
print(x)
for func in [one, two, three]:
func()
print(x)
This exercise is part of the course
Writing Functions in Python
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
