皇冠足球体育

If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Challenge: Dice rolls

Instructions

Step 1

Repeat the experiment

Minh wrote a program that uses the random module to roll two six-sided dice and then displays the dice total. Lucky! He rolled a 12 this time but wonders - what’s the average dice roll?

  • Use a while loop to repeat Minh’s experiment 10 times.

The two dice should be rolled 10 times, and on each of the 10 rolls, the program should print the dice_sum. You’ll need to add a loop variable to count to 10 rolls, and increment it on each loop iteration.

Code editor

Code files

Output