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時結束。''' –