I can not make heads or tails of this….
| A coin toss can be simulated by using a random number. A 1 represents heads and 0 represents tails. It can be done using the following code. | ![]() |
import random coin = random.randint(0,1)
You need to write a if statement which will keep count of the number of times heads or tails are thrown. Also add a while loop to allow multiple coins to be tossed. Finally you can work out the percentage of heads or tails that have come up.
You need to log in or create an account to submit code!












