← Back

Code Challenge 14 - Heads or Tails Game


Introduction

Heads or tails is a simple game where someone flips a coin and hides how it landed. The top side of the coin is heads, and the bottom side of the coin is tails. The goal of the game is for the player to correctly guess which side of the coin landed on top.

Skills to Practice

Challenge Tasks

  1. Create a console project named CodeChallenge14HeadsOrTails.
  2. Use random number generation to flip ‘heads’ or ‘tails’.
  3. Prompt the user to guess “heads” or “tails”.
  4. Tell them if they guessed correctly or incorrectly.
  5. Ask the user if they want to play again. If so, start a new game.
  6. Track the wins and losses.

Sample Output