Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- def display():
- print("You're on your way home and you come to a crossroad.")
- print("One path leads you home and the other leads to a very dangerous place where the unknown creatures live.")
- print()
- def choosepath():
- path = ''
- while path != '1' and path != '2':
- path = input("Which path will you choose? '1' or '2': ")
- return path
- def checkpath(chosenpath):
- print("You head down the path,")
- print("but you're not sure where it takes you.")
- time.sleep(3)
- print()
- list1 = [1,2]
- correctpath = random.randint(*list1)
- print(correctpath)
- if int(chosenpath) == (correctpath):
- print("You're safe and you made it home!")
- print("You choose the right path.")
- print()
- else:
- print("A monster running your way.")
- print("It might attack you and get yourself killed.")
- time.sleep(3)
- print("\nYou're dead! \nYou choose the wrong path.")
- print()
- def game():
- play = True
- while play == True:
- display()
- choice = choosepath()
- checkpath(choice)
- playagain = input("Do you want to play again (Yes or No?): ")
- if playagain == "yes" or playagain == "Yes":
- play = True
- elif playagain == "no" or playagain == "No":
- play = False
- print("\nAdventure ends.")
- game()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement