2017-03-14 6 views
0

これは私のスクリプトファイル<module>とValueErrorの "パイソン"、33行、 'オプション[1-2]を選択します。' というエラーが発生した

name = input("Hello, to proceed please enter your name:") 
print ("Hello captain %s, we have a new mission for you... its is very important. are you willing to take the risk to lead this mission?" % name) 
print (50 * '-') 
print ("Option 1) Yes") 
print ("Option 2) No Way!") 
print (50 * '-') 
do_mission = input("Selct a option [1-2]:") 
do_mission = int(do_mission) 
if do_mission == 1: 
    print ("We are glad you were willing to take the job!") 
elif do_mission == 2: 
    print ("We are sorry but we need you, if you do not accept we will have to kill you. Comprende?") 
    print (50 * '-') 
    print ("Option 1) I comprende.") 
    print ("option 2) I do not comprende.") 
    print (50 * '-') 
comprende = input("Select an option [1-2]:") 
comprende = int(comprende) 
if comprende == 1: 
    print ("Good! We are glad you understand! Now, here are your instructions") 
elif comprende == 2: 
    print ("We are sorry it had to be this way...") 
    print (50 * '-') 
    print ("GAME OVER") 
    print (10000 * '-') 
print ("You %s are going to be our strategic thinker in this battle. We need you to think of EVERYTHING that could happen. We are going to be your eyes and ears and you are going to be our brains. EVERY decission matters, so make sure to answer carefully or bad things could happen to you and us..." % name) 
print ("My final question is, are you ready to go into battle?") 
print (50 * '-') 
print ("Option 1) Yes!") 
print ("Option 2) No!") 
print (50 * '-') 
battle = ("Select an option [1-2]:") 
battle = int(battle) 
if battle == 1: 
    print("You went to battle and died... Guess you should have just answered no and stayed back...") 
    procede_to_pass = ("Press enter to continue") 
elif battle == 2: 
    print ("You are smart! You and your whole team lived because peace = lyfe! :D") 

です私はその構文エラーと思う。あなたの助けをありがとう。

+1

こんにちはとライン32と33を交換し、SOへようこそ。より良い質問をするには[ask]と[mcve]をお読みください。 – davejal

答えて

1

キーボード入力を行いたい場合、そのタイプは整数です。 Pythonでは、以下の行で整数入力を取得し、バトル変数に格納することができます。

この

battle = int(input("Select an option [1-2]:"))

関連する問題