1. 局部变量.全局变量 局部变量: x = 50 def func(x): x = 2 print('Change local x to',x) func(x) print('x is still',x)输出: Change local x to 2x is still 50 全局变量: x = 50 def func(): global x print('x is',x) x = 2 print('Change global x to',x) func() print('Value of x…