Question: import random # Initialize variables roll _ count = 0 total _ sum = 0 # While loop to repeat the experiment 1 0 times
import random
# Initialize variables
rollcount
totalsum
# While loop to repeat the experiment times
while rollcount :
# Roll two sixsided dice
die random.randint
die random.randint
# Calculate the sum of the dice
dicesum die die
# Print the dice sum for this roll
printfRoll rollcount : The dice sum is dicesum
# Add the dice sum to the total sum
totalsum dicesum
# Increment the roll count
rollcount
# Calculate and display the average dice roll
averageroll totalsum
printf
The average dice roll over rolls is averageroll:f
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
