If you roll one six-sided die, every number from 1 to 6 has an equal shot of showing up: exactly a 1 in 6 (or about $16.7\%$) chance.
But what happens when you roll two dice and add the numbers together?
Do all sums from 2 to 12 have an equal chance? If you've ever played board games like Settlers of Catan, Craps, or Monopoly, you probably already suspect the answer is a big "No!"
Why? Because there's only one way to roll a 2 ($1+1$) and only one way to roll a 12 ($6+6$). But to get a 7, you could roll $1+6$, $2+5$, $3+4$, $4+3$, $5+2$, or $6+1$—that's six different ways!
In this lesson, we'll roll two dice $10{,}000$ times, count how often each sum from 2 to 12 occurs, and see what the "shape of luck" really looks like.
sum = d1 + d2
Move the mouse over a dotted box for more information.
Notice how the percentage for 7 climbs up toward $16.7\%$ ($6/36$), while 2 and 12 linger down near $2.8\%$ ($1/36$).
Now you try.
Try changing N to a small number, like 50. Does the distribution still look neat and smooth, or is it messy and noisy? What happens when you bump N up to 50,000?
Type your code here:
See your results here:
To complete this lesson: We want to find the distribution of sums when rolling two dice. Look at the code above:
1. In the rolling loop, sum is currently set to 0—change it to add the two dice: sum = d1 + d2.
2. In the print loop, pct is currently set to 0—change it to calculate the percentage of total rolls: pct = (counts[s] / N) * 100.
Then click Run to reveal the pyramid shape of luck! (If you get stuck, click the Example button above to view the full working solution).
Share your code
Show a friend, family member, or teacher what you've done!