Python 2.7 获取错误&x27;SyntaxError:can';t分配给函数调用';
我试图从A、B或C中减去'remove'变量中的值,而不在while循环中使用if…else,但这会导致第9行出现语法错误。这背后的原因是什么Python 2.7 获取错误&x27;SyntaxError:can';t分配给函数调用';,python-2.7,while-loop,Python 2.7,While Loop,我试图从A、B或C中减去'remove'变量中的值,而不在while循环中使用if…else,但这会导致第9行出现语法错误。这背后的原因是什么 print "\t\t\t\t\t Welcome to the game of piles" A=3 B=3 C=3 print "A: %d\t B: %d\t C: %d" %(A,B,C) while A>0 and B>0 and C>0: choose_pile = raw_input("\nChoose a pi
print "\t\t\t\t\t Welcome to the game of piles"
A=3
B=3
C=3
print "A: %d\t B: %d\t C: %d" %(A,B,C)
while A>0 and B>0 and C>0:
choose_pile = raw_input("\nChoose a pile: ")
remove = input("How many to remove from pile %s" %choose_pile)
int(choose_pile)=int(choose_pile)-remove
更改int(选择_桩)以选择_桩
choose_pile = int(choose_pile)-remove
变量choose\u pile
将是一个int对象。如果需要对其进行打字,则必须使用不同的语句,例如:
x = int(x)