top of page

PROGRAMMING CHALLENGES

Coin Flip Simulation

Difficulty:

2 Medium

1.1 Random Numbers

Topic:

Write a program that simulates flipping a coin a specified number of times. The program should ask the user to enter the number of coin flips, and then simulate the coin flips using random numbers. The program should output the number of heads and tails obtained.

INPUTS: Number of coin flips (integer)PROCESSES:1. Import the random module2. Accept user input for the number of coin flips3. Use a loop to simulate the coin flips using random.randint(0, 1) (0 for tails, 1 for heads)4. Keep track of the number of heads and tailsOUTPUTS: Number of heads and tails obtained (integers)









Need help with your programming skills?

If you need more help than just independent practise, then we're here for you. Book a 1:1 with us and we will be able to guide you to becoming a proficient programmer who can tackle any of the challenges an exam board can throw at you.

bottom of page