このPythonファイルの多くのエラーは修正されましたが、動作しない最後のものが1つあります。はいまたはいいえが入力されていない場合、もう一度質問をするためにループするためにelse文が必要です。あなたはおそらく私が行っていたことをコードで見ることができますが、私はおそらく正しい軌道にもないでしょう。誰かがこの最後のことを私に助けてくれる?Python:Loop Prompt Back around
#These are my variables which are just strings entered by the user.
friend = raw_input("Who is your friend? ")
my_name = raw_input("Enter Your Name: ")
game_system = raw_input("What's your favorite game system? ")
game_name = raw_input("What's your favorite game for that system? ")
game_status = raw_input("Do you have the game? (Yes or No) ")
game_store = raw_input("What is your favorite game store? ")
game_price = raw_input("What's the price of the game today? Enter a whole number. ")
#This is what is printed after all the prompts. There is no condition for this print.
print "I went outside today and my friend " + friend + " was outside waiting for me. He said \"" + my_name + ", did you get the new " + game_system + " game yet? You were getting " + game_name + " today, right?\""
#If the condition on the Yes or No question is yes, then this code runs.
if game_status == "YES":
print "\"You know I got it, man!\" I said. \"Awesome! Let's play it,\" he said. \"I heard " + game_name + " is supposed to be amazing!\" We went back inside and took turns playing until " + friend + " had to go home. Today was a fun day."
#If the condition is No, then this code runs.
elif game_status == "No":
print "\"Well let's go get it today and we can come back here and play it!\" We went down to " + game_store + " and baught " + game_name + " for $" + str(game_price) + " and we went back to my house to take turns playing until " + friend + " went home. Today was a good day. (Now try again with the No option!)"
#If the condition meets neither Yes or No, then this code runs, sending the user back to the same question again. This repeats until a condition is met.
else:
raw_input("That answer didn't work. Try again? Do you have the game? (Yes or No) ")
行くべき、同様
に行く必要がありますそこに行こう。 – user2357112
これは本当に具体的ではありません。そこには3つのコロンがあります。 –