print("Hello there")
name=input("What is your name?")
print("Welcome to the some game, " + name + "!")
print("I'm going to ask you some basic questions so that we could work together")
age=input("Your age")
if age >= 14 and age < 41:
print("K")
else:
print("Sorry bruh")
print("Thanks")
不断向我展示“Sorry bruh”,当输入15时结束。为什么?怎么了?为什么这个简单的代码是错误的?
尤斯巨蟒-3我得到'类型错误:unorderable类型:STR()> = INT()'和使用Python 2我没有得到任何问题。 (其他然后不能使用字符串名称) –
@Tadhg,你得到没有错误,但你得到了错误的答案。 Python 2在不兼容的情况下比较类型的_names_! ('“int”<“str”') – alexis
@alexis no,对于python 2,如果您在输入'15'时输入'K',则在python 3上尝试比较str时发生错误int,所以我无法重现'''显示我“抱歉bruh”在进入15时结束。''' –