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.
- Start a new Python program
- Use the code in the screenshot
- Watch the idents and brackets
- Save your program
- Run the program to check that it works
- Run your program a few times
Can you beat the odds and roll a 12 quicker than average?
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?