我正在編寫python中的測驗。一切似乎工作,直到我嘗試輸入答案。我對此很新。也可以有人解釋縮進塊是什麼和它的一個例子。 這是代碼:我想用python編碼測驗,但它不工作
>>> print('physics quiz')
physics quiz
>>> print('round 1')
round 1
>>> print('what is the 1st stage of a stars life?')
what is the 1st stage of a stars life?
>>> print('a...protostar')
a...protostar
>>> print('b...nebula')
b...nebula
>>> print('c...red giant')
c...red giant
>>>answer=int(input('you have 5 seconds'))
you have 5 seconds
'a'
if answer=='a':
print('correct')
else:
print('incorrect, it was protostar')
爲了正確地格式化你的代碼,你必須在它之前和之後放置一個換行符,並在你的代碼的每一行縮進另外的4個空格。 – jotasi
歡迎來到Stack Overflow。最好發佈代碼,以便我們可以快速查看哪些錯誤存在,以及可能的解決方案是否可行。有關更多信息,請參閱此處:http://stackoverflow.com/help/mcve – Toby