分析如下Python代码,关于代码中关键字使用与输出结果的说法正确的是?

zw380238 单选题 共 个子题
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

正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧