top of page


Coin Flip Simulation


2 Medium

1.1 Random Numbers


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)

1. Import the random module
2. Accept user input for the number of coin flips
3. 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 tails

OUTPUTS: 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