测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A44254. 调用嵌套函数outer(),两次输出变量x的值是不一样的。 def outer(): x = “local” def inner(): x = ‘nonlocal’ print(“inner:”, x) inner() print(“outer:”, x)

判断题 较难

题目描述

调用嵌套函数outer(),两次输出变量x的值是不一样的。

 def outer():

     x = “local”

     def inner():

         x = ‘nonlocal’ 

         print(“inner:”, x)

     inner()

     print(“outer:”, x)

选项(单选)

上一题 下一题