求解答作用域范围
为啥定义在外围会报错呢,python是否存在作用域链呢
sum = 0def my_sumA(n): index = 1 while index <= n: sum += index index += 1 return sumres=my_sumA(100)print(res)
为啥定义在外围会报错呢,python是否存在作用域链呢
sum = 0def my_sumA(n): index = 1 while index <= n: sum += index index += 1 return sumres=my_sumA(100)print(res)
2021-11-27
举报