Advertisement
182days

Functions (Game)

May 10th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. #basic game using functions
  2. def live():
  3.     print("You have survived the game! Well done!!!")
  4. def die():
  5.     print("You have died! Better luck next time!!!")
  6. def password():
  7.     c5 = input("What is the password?")
  8.     if c5=="1234":
  9.         print("The man shows you the way out to freedom!")
  10.         live()
  11.     else:
  12.         print("You gave the wrong password, the man pulls out his gun.")
  13.         die()
  14. def garden():
  15.     print("You find yourself in a garden with a cave and a person")
  16.     c1 = input("(E)nter the cave or (S)peak to the person?")
  17.     if c1 =="e":
  18.         print("The cave is full of rats!!!")
  19.         die()
  20.     elif c1=="s":
  21.         print("You speak to the person and he asks you for a password.")
  22.         password()
  23. print("You are in a room with 2 doors.")
  24. c2 = input("(L)eft door or (R)ight door?")
  25. if c2=="l":
  26.     garden()
  27. elif c2=="r":
  28.     print("You enter a room with a window and a door.")
  29.     c3 = input("Climb out of the (W)indow or use the (D)oor?")
  30.     if c3=="w":
  31.         garden()
  32.     elif c3=="d":
  33.         print("You enter a kitchen with a window and a person.")
  34.         c4 = input("(S)peak to the person or climb out of the (W)indow?")
  35.         if c4=="s":
  36.             print("The person tells you a password '1234' and takes you to the garden.")
  37.             garden()
  38.         elif c4=="w":
  39.             print("The window is on the 20th floor of a skyscraper, you fall to your death!")
  40.             die()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement