只是學習如何編寫代碼,並想製作一個小程序來查看我所知道的內容。如果聲明沒有讀取輸入
n = int(input("Pick a number any Number: "))
if n > 100:
print ("No... Not that Number")
else:
answer = input("Would you like to know your number?")
if answer == "Y" or "Yes" or "y" or "yes":
print ("Your number is %s" % (n))
elif answer == "N" or "No" or "n" or "no" or "NO":
print ("Oh, well that's a shame then.")
else:
print ("Please type Yes or No")
input("Press Enter/Return to Exit")
一切正常,除了第二if
語句,它不遵循任何進入input
數據。爲什麼會這樣做?
糾正壓痕第一 –
是整個代碼或者這是一個while循環的身體? – Rosh