理解作用域
这个脚本会打印出哪四个值?
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)
本练习是课程的一部分
这个脚本会打印出哪四个值?
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)
本练习是课程的一部分