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」と表示され続けます。なぜですか?どうしましたか?この単純なコードはなぜ間違っていますか?
ウッシングのpython 3私はTypeError例外 '得る:unorderableタイプ:STR()> = INT()'と私は何の問題を取得していないのpython 2を使用して。 (それ以外の文字列名は使用できません) –
@ Tadhg、エラーは発生しませんが、間違った答えが出ます。 Python 2は、互換性のない型の_names_を比較します。 ( '" int "<" str "') – alexis
@alexisいいえ、Python 2 Python 3に 'K'を出力する時に' 15'をタイプすると、strとの比較時にエラーが発生します。 int、私は15を入力したとき最後に私に "Sorry bruh"を表示する '' 'を再現することができません。' '' –