파이썬에서 퀴즈를 만들려고하는데 잘못된 구문 오류가 계속 발생합니다.파이썬 잘못된 구문 IF 문
#This is for addition questions.
if (question=add) <---- That is where i get the error
for i in range(0,10):
first_number_add=random.randint(1,50)
second_number_add=random.randint(1,50)
answer=int(input(str(first_number_add) + '+' + str(second_number_add) + '='))
sum=first_number_add+second_number_add
if (answer==sum):
print ('Correct')
stats['correct'] += 1
else:
print ('Incorrect.')
stats['incorrect'] += 1
"<---- 그 곳에서 오류가 발생합니다"는 실제 코드에 없습니다. – JD245
콜론을 놓친 것 같습니다. –
'if (question = add)'대신'=='를 사용하고':'를 추가하십시오. – Maroun