Mar-21-2018, 05:55 PM
Hello, I've been tasked with creating a simple choice based text game revolving around a general theme, which I choose to be Greek mythology. For the life of me I cannot figure out why the if statement on line 11 always runs regardless of the previous input. I'm very new to this and any insight would be much appreciated! Here is my code:
Here is the output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
def start(): print ( "Greetings Traveler! I am the mystical spirit that inhabits these lands" ) name = input ( "What is your name traveler?... " ) print ( f "Oh, so your name is {name}?" ) print ( "Nice to meet you." ) print ( f "Might I ask which god you follow in this war {name}?" ) god = input ( "Zeus, Poseidon, or Hades?.. " ) if god = = "Zeus" or "zeus" : #Always get stuck here regardless of the above input. hmmmmm.... #zeus_prayer() print ( "Zeus chosen" ) elif god = = "Poseidon" or "poseidon" : #poseidon_prayer() print ( "Poseidon chosen" ) elif god = = "Hades" or "hades" : #hades_prayer() print ( "Hades chosen" ) elif god = = "No one" or "No god" or "Nobody" : print ( f "So you are godless, {name}?" ) print ( "I like your style." ) print ( f "I shall now call you {name} the godless." ) name = name + "the godless" print (name) #the_vision() else : print ( "Oh? I haven't heard of that god. How boring, perhaps you should worship someone who is worthy." ) print ( "Tell you what, I'm going to pretend like I didn't hear that and we're going to start this conversation over. Deal?" ) print ( "Hopefully you could try to be more entertaining next time." ) start() start() |
Output:Greetings Traveler! I am the mystical spirit that inhabits these lands
What is your name traveler?... Tyler
Oh, so your name is Tyler?
Nice to meet you.
Might I ask which god you follow in this war Tyler?
Zeus, Poseidon, or Hades?.. Hades
Zeus chosen
Regardless of what input I put in for line 9, the if statement on line 11 always runs and I can't seem to figure out why.