Question: import random # Initialize variables roll _ count = 0 total _ sum = 0 # While loop to repeat the experiment 1 0 times

import random
# Initialize variables
roll_count =0
total_sum =0
# While loop to repeat the experiment 10 times
while roll_count <10:
# Roll two six-sided dice
die1= random.randint(1,6)
die2= random.randint(1,6)
# Calculate the sum of the dice
dice_sum = die1+ die2
# Print the dice sum for this roll
print(f"Roll {roll_count +1}: The dice sum is {dice_sum}")
# Add the dice sum to the total sum
total_sum += dice_sum
# Increment the roll count
roll_count +=1
# Calculate and display the average dice roll
average_roll = total_sum /10
print(f"
The average dice roll over 10 rolls is {average_roll:.2f}")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!