Advertisement
Guest User

KAreen's code

a guest
Jul 19th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1.  
  2.  
  3. def StartSection():
  4.  
  5. guessed = False
  6. wrong_guess = 0
  7. while not guessed:
  8. guess = input("As a stone inside a tree, I'll help your words outlive thee. But if you push me as I stand, the more I move the less I am. You have three tries to guess correctly or death will be upon you\n")
  9. if guess == "pencil":
  10. guessed = True
  11. WinCondition()
  12. elif wrong_guess == 3:
  13. print("You died.")
  14. LoseCondition()
  15.  
  16. else:
  17. wrong_guess += 1
  18. print("\nWrong guess you have guessed wrong " + str(wrong_guess) + " times")
  19.  
  20. def WinCondition():
  21. print("You won good job")
  22. Restart()
  23. def LoseCondition():
  24. print("You've Died:(")
  25. Restart()
  26.  
  27. def Restart():
  28. restart = input("Press g to play again. Press any other key to stop")
  29. if restart == "g":
  30. StartSection()
  31. else:
  32. print("See ya later")
  33. exit()
  34.  
  35.  
  36. if __name__ == '__main__':
  37. StartSection()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement