2016-11-05 2 views
2

A, B 또는 C에서 'remove'변수의 값을 빼기 위해 while ... while while else while 루프를 사용하지 않고 코드를 뺍니다. 9 번 줄에 구문 오류가 발생합니다. 이유는 무엇입니까?'SyntaxError : 함수 호출에 할당 할 수 없습니다'

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 

답변

0

int (choose_pile)을 choose_pile로 변경하십시오.

choose_pile = int(choose_pile)-remove 

변수 choose_pile은 int 객체입니다. 유형 변환을해야하는 경우 다음과 같은 다른 문구에서이를 수행해야합니다.

관련 문제