I have been making an Adventure Game and when I try to test it, it always comes up with
Hello! Welcome to the adventure game! What is your name? Parsia Parsia? Well hello there! Let us begin... You are at a trail with two paths. Left or right? left Traceback (most recent call last): File "/Users/mhedayat/Desktop/Dropbox/AdventureGame.py", line 8, in <module> if partone == left: NameError: name 'left' is not defined
Here is the code:
print "Hello! Welcome to the adventure game!" name = raw_input("What is your name? ") print name + "? Well hello there!" print "Let us begin..." partone = raw_input("You are at a trail with two paths. Left or right? ") partone.lower() str(partone) if partone == left: print "You are now heading toward a town! You have survived! [Move on]" elif partone == right: print "You accidently fall into a sandpit and die! You lose. [Exit Game]" else: print "Not a choice!" parttwo = raw_input("You are now in a village. A farmer offers you a beet or a bubbling potion. Which one?") parttwo.lower() if parttwo == potion: print "You now have cancer and will die in a couple minutes. You lose. [Exit Game]" elif parttwo == beet: print "You eat the beet and grow close to the farmer. You get to stay the night with him. You survived! [Move on]" else: print "Not a choice!" partthree = raw_input("You're at the farmers house and he lets you stay in 1 of 2 rooms. First or second?") partthree.lower() if partthree == first: print "You walk into the room and see nothing but the farmer and a girl with pigtails. You are probably screwed. [Move on]" elif partthree == second: print "This room has a nice bed and nightstand. You are able to sleep the night! [Move on]" else: print "Not a choice!"
Please help me figure this out. Thank you.