Classic guess the number game, set in a tavern.
import random print('The Bartenders Game v1.0\n') print('''The bartender looks up as you come in. 'Ere, want to play a game? I call it guess the mug the ball is in. Probably need a shorter title.'\n''') print('''The bartender places a ball under a mug, puts down three other mugs, and moves them around too fast for you to follow. 'So, what glass is the ball under? 1, 2, 3, or 4? Give you two tries!''') def game(): guesses =2 number = random.randint(1,4) play_game= True while play_game == True: choice = input('\nI choose...') choice = int(choice) if choice == number and guesses != 0: print("'Well, you won.' The bartender looks puzzled at" ' this. Have a drink on me.') break elif choice != number and guesses != 0: guesses -= 1 print("'Fraid not. Try again.") elif choice != number and guesses == 0: print('"Too bad there mate. Have a drink on me"') break play_game = True while play_game == True: game() play_again = input('Play again? (Y)es or (N)o?') if play_again.lower() == 'y': continue elif play_again.lower() == 'n': break