当我尝试在一行中增加变量时,为什么会收到错误?
one = 12
two = 13
while one + two <40:
one,two = one+=1, two+=1
答案 0 :(得分:0)
您尝试更改
这样的值one = one+=1
这是无效的,因为one+=1
实际上已经增加了one
值
你可以通过这些方式实现你想要做的事情
第一种方式
one, two = 12, 13
while one + two < 40:
one+=1
two+=1
第二种方式
one, two = 12, 13
while one + two < 40:
one, two = one + 1, two +1