Simple console Heads/Tails game written in Python.

# ? 2017 TheFlyingKeyboard and released under MIT License

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;
    heads = False;
  playerInput = input("H for heads, T for tails, E - exit").lower()
  if playerInput == "h":
      wins += 1
      loses += 1
  elif(playerInput == "t"):
      loses += 1
      wins += 1
  elif(playerInput == "e"):
    isPlaying = False


Python Console Heads Tails Game
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. You can read more about it the Cookies&Privacy Policy Section Above. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this. You can read more about it the Cookies&Privacy Policy Section.