Simple Python Games: Coin Toss

Source code of coin_toss.py

from random import choice


side_names = ('heads', 'tails')

guess = input('Enter your guess (heads/tails): ').lower()
flip_result = choice(side_names)

print('Yes!' if flip_result == guess else 'No...', 'It was', flip_result)

Tips for improvement

  1. Add the while cycle and handle the 'exit' option
  2. Enable player to enter just the initial letter(s) of his/her choice
  3. Show the player/computer score

Download

Source code of Coin Toss (coin_toss.py).