#54318: 誰來幫我除錯~~~~~


00030@gsuite.essh.kl.edu.tw (明天一定過!)


為什麼以下程式無法運行?

M,D=map(int,input().split())
S=(M*2+D)%3
if S==0:
print("普通")
if S==1:
print("吉")
if S==2:
print("大吉")

而換成這樣就可以了?

M, D = map(int, input().split())

 S = (M * 2 + D) % 3

if S == 0:

 print("普通")

 elif S == 1: print("吉")

else:

print("大吉")

 

 

#54319: Re: 誰來幫我除錯~~~~~


pofly (不挖鼻孔有害身心健康)


不確定你的排版有沒有因為各種神祕原因跑掉,兩個寫法的縮排都是不合語法的

但理論上如果縮排沒問題,兩種寫法都是可以 AC

 

縮排錯誤的話會寫 IndentationError ,可以再注意一下