第28014题 单选题
分析如下Python代码,关于代码中关键字使用与输出结果的说法正确的是?
total = 100
def add():
    total = 200
    def inner():
        # 请选择正确的关键字使用对应的输出结果
        total += 50
        print(total)
    inner()
    print(total)
add()
print(total)
A

若在inner函数中使用global total,最终三个print的输出结果依次为250、250、100

B

若在inner函数中使用nonlocal total,最终三个print的输出结果依次为250、250、100

C

若在inner函数中使用global total,最终三个print的输出结果依次为250、200、250

D

若在inner函数中使用nonlocal total,最终三个print的输出结果依次为250、200、100

程序运行统计
暂无判题统计
提交0次 正确率0.00%
答案解析