Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def playAgain():
- while True:
- try:
- replay = input("Do you want to play again? ").lower() #Asking user to play again
- except ValueError:
- print("Sorry, Invalid Entry") #If response invalid, will ask again
- continue
- if replay in ("yes","y","true","t"):
- main()
- elif replay in ("no","n","false","f"):
- print ("Goodbye")
- return
- else: #If input is invalid will ask again
- print("Invalid entry, Please enter yes or no")
- def main():
- print ("Hello")
- playAgain()
- main()
- main -> playAgain -> main -> playAgain
- ^^^
- if replay in ("yes","y","true","t"):
- main()
- return # here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement