samedi 26 janvier 2019

Invalid syntax on an else statement to a function [on hold]

So I'm making a text-adventure game in Python 2.7. I have to use several if statements inside of each other, but the first else statement is displaying an Invalid Syntax at the colon on line 17.

print "You wake up in a dim room. Cold water trickles down your spine through the rags you are wearing."
def exit_or_explore():
  q1 = raw_input("Exit or Explore? ")
  if q1 in ("explore", "Explore","EXPLORE",):
    print "You search the room. All you find is a small, maroon object. You reach for it, but all of the sudden, it explodes. You are dead."
    exit()
  elif q1 in ("exit","EXIT","Exit",):
    print "Light flashes before your eyes as you find yourself on a scenic mountaintop. It drops to the north and west. To the east is a winding road. In the distance you see a village."
  def direction1():
    q2 = raw_input("Which direction do you go? ")
    if q2 in ("North","north","NORTH","West","west","WEST",):
      print "You clumsily stumble off the cliff. You are dead."
      exit()
    elif q2 in ("east","EAST","East",):
      print "You travel for a few hours and arrive at"
  else:
    exit_or_explore()
exit_or_explore()

Aucun commentaire:

Enregistrer un commentaire