Drawer

A Simple Coin Toss Game

This is a very simple python script using inbuilt 'Random' library for an interactive random coin toss game.

Written in VSCode, tested on Ubuntu 24.04.01 LTS running Python V. Environment, version 3.13.0

## This is a simple python script to make a simple coin toss game

from random import choice
choices = ['heads', 'tails']

## Loop
while True:
    user_choice = input('Heads or Tails? ').lower()
    if user_choice not in choices:
        print('Invalid choice')
        continue
    computer_choice = choice(choices)
    if user_choice == computer_choice:
        print('You win! Yay!')
    else:
        print('You lose! Womp womp..')

## Replayability
    play_again = input('Play again? (y/n) ').lower()
    if play_again != 'y':
        break
print('Thanks for playing. Goodbye!')

A Simple Coin Toss Game - image 1 - student project

 

Any and all feedback is appreciated. Thank you for checking out my project.