Dice Thrower

Step 8 – heads or tails

In series 16 of the TV show Taskmaster, one task involved the contestants having to toss a coin and get five consecutive heads.

If you throw a tails you have to start again.

This can be coded in Python – but I'm not going to show you all of the answer.

A coin is just a die with 2 sides if you think about it.

  1. Use a new program
  2. The code in the screenshot shows you some of the code you need
  3. The rest of the code is the ideas you can find in the other steps

This isn't easy. But it's not difficult either.

Code helper image

This was actually a task in series 3 of Taskmaster New Zealand first if you want to be really picky.

The probability of throwing 5 heads in a row is 1 in 32 by the way

Some of these ideas can be used in other projects.