import random def ht_game(): # user chooses h/t choice = input("heads or tails") #flip a coin coin = coin_flip() #announce win/loss if choice == coin: print("You won") else: print("You lost") def coin_flip(): flip = random.randint(1,2) if flip == 1: flip = "heads" else: flip = "tails" return flip ht_game()