I'm using python IDLE v. 2.7.2 and I get the same error report with my program.
>>> def menu(list, question):
for entry in list:
print 1 + list.index(entry),
print ") " + entry
return input(question) - 1
[B]items[/B] = ["Cup","Vase","Table","Lamp","Bowl","Door"]
keylocation = 3
keyfound = 0
loop = 1
print "Welcome to The Great Text Adventure!"
print "One day you wake up, in a room, locked in by yourself."
print "Could there be a key?
print "In the room you see."
print len (items), "things:"
for x in items:
print x
print ""
while loop == 1
choice = menu(items, "What do you want to inspect? ")
if choice == 0:
if choice == keylocation:
print "You found a key in the cup."
print ""
keyfound = 1
else:
print "You found nothing in the cup."
print ""
elif choice == 1:
if choice == key location
print "You found a key in the vase."
print ""
keyfound = 1
else:
print "You found noting in the vase."
print""
elif choice == 2:
if choice == keylocation:
print "You found a key on the table."
print""
keyfound = 1
else:
print "You found nothing on the table."
print ""
elif choice == 3:
if choice ==keylocation:
print "You found a key under the lamp."
print""
keyfound = 1
else:
print "You found nothing under the lamp."
print ""
elif choice == 4:
if choice == keylocation:
print "You found a key in the bowl."
print ""
else:
print "You found nothing in the bowl."
print ""
elif choice == 5:
if keyfound == 1:
loop = 0
print "You put in the key, turn it, and hear a click."
print ""
else:
print "The door is locked, you need to find a key."
print ""
unlockeddoor = 0
loop2 = 1
doors = ["Blue Door","Green Door","Red Door"]
print "You walk into the next room."
print "You see a blue door to your left, a green door to your right, and a red door straight ahead."
while loop2 == 1
choice = menu(doors,"Which door should you take? ")
if choice == 0
if choice == unlockeddoor
print "The door is unlocked."
print ""
loop2 = 0
else:
print "The door was locked."
print ""
elif choice == 1
if choice == unlockeddoor
print "The door is unlocked."
print ""
loop2 = 0
else:
print "The door was locked."
print ""
elif choice == 2
if choice == unlockeddoor
print "The door is unlocked."
print ""
loop2 = 0
else:
print "The door was locked."
print ""
correctdirection = 1
directions = ["North","South","East","West"]
loop3 = 1
print "You walked through the door and saw sunlight."
print "You realized that the town is abandoned."
print "You can go North, South, East, or West."
while loop3 == 1
choice = menu(directions, "Which direction should you go? ")
if choice == 0
if choice == correctdirection
print "You walked 2 miles North and found a bridge over a canyon."
print ""
loop3 = 0
else:
print "You walked 2 miles North and found a canyon. You had to turn around."
print ""
elif choice == 1
if choice == correctdirection
print "You walked 2 miles South and found a bridge over a river."
print ""
loop3 = 0
else:
print "You walked 2 miles South and found a river. You had to turn around."
print ""
elif choice == 2
if choice == correctdirection
print "You walked 2 miles East and found a tunnel through a mountain."
print ""
loop3 = 0
else:
print "You walked 2 miles East and found a mountain. You had to turn around."
print ""
elif choice == 3
if choice == correctdirection
print "You walked 2 miles West and found a tunnel through a mountain."
print ""
loop3 == 0
else:
print "You walked 2 miles West and found a river. You had to turn around."
print ""
print "You won!"
print "Thank you for playing The Great Text Adventure."
print "Check back later for more updates."
print "Credits: http://www.********.com/ for the idea and basic script."
print "Scripted mostly by ****** *******."
SyntaxError: invalid syntax
>>>
(The *'s at the end are to hide my name and a website i used) Please help me with this, its my first program.(bold was highlited)