只是做一個簡單的遊戲,在1到20之間增加了兩個隨機數,我得到以下錯誤:Python的,如果聲明無效的語法
import random
randomInt1 = (random.randint(0,20))
randomInt2 = (random.randint(0,20))
answer1 = int(raw_input("What is" + str(randomInt1) +"+"+ str(randomInt2)+ "?")
if answer1 == randomInt1 + randomInt2:
print "That is correct!"
else:
print "Incorrect answer!"
的: if語句被突出顯示。
檢查'if'語句的縮進應該是內聯。與「answer1 = ...'聲明 – rayryeng 2014-10-05 23:23:25
您忘記在帖子中包含錯誤 – 2014-10-05 23:24:09
[Python」unexpected indent「]的可能重複(http://stackoverflow.com/questions/25100948/python-unexpected-縮進) – W1ll1amvl 2014-10-05 23:38:51