pyBegin / projects / coin-flip
🪙

Coin Flip

This is a Python program used to simulate a coin toss, in which a user is asked to pick a side (heads or tails), and the program selects a result a…

82 linesRunnable

Coin Flip

This is a Python program used to simulate a coin toss, in which a user is asked to pick a side (heads or tails), and the program selects a result at random between the two options. If the user's choice matches the result, they win the coin toss.

How to Play

  1. When the program is initiated, you will be prompted to choose either "heads" or "tails".
  2. The program will then determine the winning result by random chance, and display it.
  3. If your choice matches the result, you win the coin toss. If not, you'll receive a "OOF" message to indicate a loss.
  4. After the end of each round, you will be asked if you want to play again. Type "yes" to continue playing or "no" to exit the program.

Enjoy!

Pyodide-runnable

Yes — it is a pure-stdlib console program that only uses random and input/print.