num + = num 不等于num = num + num
例如:
a = [100]def sum(num): # num += num num = num + num # 不等于num += num print(num)sum(a)print(a)
输出结果:[100,100]
[100]
a = [100]def sum(num): num += num print(num)sum(a)print(a)
输出结果:[100,100]
[100,100]
本文共 317 字,大约阅读时间需要 1 分钟。
num + = num 不等于num = num + num
例如:
a = [100]def sum(num): # num += num num = num + num # 不等于num += num print(num)sum(a)print(a)
输出结果:[100,100]
[100]
a = [100]def sum(num): num += num print(num)sum(a)print(a)
输出结果:[100,100]
[100,100]
转载于:https://www.cnblogs.com/sineik/p/8595985.html