Simple console Heads/Tails game written in Python.
# ? 2017 TheFlyingKeyboard and released under MIT License # theflyingkeyboard.net from random import randint isPlaying = True wins = 0 loses = 0 heads = True while isPlaying: print("Wins:", wins, "Loses:", loses) if randint(0, 100) < 50: heads = True; else: heads = False; playerInput = input("H for heads, T for tails, E - exit").lower() if playerInput == "h": if(heads): wins += 1 else: loses += 1 elif(playerInput == "t"): if(heads): loses += 1 else: wins += 1 elif(playerInput == "e"): isPlaying = False
Python Console Heads Tails Game