Dice Thrower

Dice image

Step 7 – rolling 12 on 2d6

When you're rolling dice, probability comes into play.

With two six sided dice, for example, there are lots more ways to make a total of 7. It's the most probable result.

But there's only one way to roll a 12: both die rolls need to be a 6.

The probability is actually 1 roll in 36 attempts (about a 2.8% chance)

We can test this out using Python.

  1. Start a new Python program
  2. Use the code in the screenshot
  3. Watch the idents and brackets
  4. Save your program
  5. Run the program to check that it works
  6. Run your program a few times

Can you beat the odds and roll a 12 quicker than average?

Code helper image

If you roll 3 six sided dice the chances of rolling an 18 (6 + 6 + 6) is 1 in 216 (just under 0.5% of the time).

Challenge: can you change the program to deal with the chances of an 18 on 3d6?