只是学习如何编写代码,并想制作一个小程序来查看我所知道的内容。如果声明没有读取输入
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