Advertisement
Guest User

Untitled

a guest
Sep 5th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. def playAgain():
  2. while True:
  3. try:
  4. replay = input("Do you want to play again? ").lower() #Asking user to play again
  5. except ValueError:
  6. print("Sorry, Invalid Entry") #If response invalid, will ask again
  7. continue
  8. if replay in ("yes","y","true","t"):
  9. main()
  10. elif replay in ("no","n","false","f"):
  11. print ("Goodbye")
  12. return
  13. else: #If input is invalid will ask again
  14. print("Invalid entry, Please enter yes or no")
  15.  
  16. def main():
  17. print ("Hello")
  18. playAgain()
  19.  
  20. main()
  21.  
  22. main -> playAgain -> main -> playAgain
  23. ^^^
  24.  
  25. if replay in ("yes","y","true","t"):
  26. main()
  27. return # here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement