0
counter = 0
q1 = input('What is the capital of Germany?')
q2 = input('What is the name of Sideshow Bobs brother?')
q3 = input('In Family Guy how many voices does Seth MacFarlane do the characters to?')
q4 = input('Which famous pianist, wrote the movement called Moonlight Sonata?')
q5 = input('Which famous rapper has recently revealed his withdrawal from music, due to a friendship problem?')
while True:
if q1 == "Berlin":
break
counter = counter + 1
else:
if q2 == "Cecil":
break
counter = counter + 1
else:
if q3 == "five":
break
counter = counter + 1
else:
if q4 == "Beethoven":
break
counter = counter + 1
else:
if q5 == "xxxtentacion":
break
counter = counter + 1
else:
print("You scored ", counter, " out of 5 ")
你'print'聲明應放在*後* while循環(修復它縮進的方式) – alfasin
刪除而。全部刪除:全部縮進基線並輸出。其編碼atm的方式會在第一個正確答案中設置爲1,打破這個尷尬局面並在不打印任何東西的情況下結束它。 –
歡迎來到SO。請花時間閱讀[問]。 – wwii