我正在創建一個數學測驗來幫助我開始使用Python,因爲我對語言非常陌生,並且它提出的unindent不匹配任何外部縮進級別錯誤消息?有人能告訴我這是什麼意思,我的錯誤在哪裏。unindent與我的數學遊戲中的任何外部縮進級別不匹配
這裏是我的代碼:
import random
questions = 0
correct = 0
print ("Welcome to the maths challenge")
print ("Out of these 10 questions how many can you get right?")
while True :
questions += 1
numberA = random.randint(0,12)
question = "What is {0}**2".format(numberA)
print(question)
response = input("Your Answer : ")
answer = numberA**2
if(int(response) == answer) :
print("Correct!")
else :
print("Wrong!")
if(questions == 10) :
print("You got {0}/{1} questions correct.").format(correct, questions)
if correct == ("5>")
print ("Better luck next time")
if correct == ("5<")
print ("You got a great score Well done!")
break
錯誤在該行。 –