Answer:
import random
def probability_five_of_a_kind(num_trials):
sums = 0
for _ in range(num_trials):
roll_1 = random.randrange(1,6, 1)
roll_2 = random.randrange(1,6, 1)
roll_3 = random.randrange(1,6, 1)
roll_4 = random.randrange(1,6, 1)
roll_5 = random.randrange(1,6, 1)
collection = roll_1 + roll_2 + roll_3 + roll_4 + roll_5
if collection == 5:
sums += 1
prob = round(sums/7776, 8)
print(f"The probability_five_of_a_kind is {prob}")
probability_five_of_a_kind(100)
probability_five_of_a_kind(10000)
probability_five_of_a_kind(1000000)
Explanation:
The random package of the python language is used to select an integer value from the range of one to six representing the sides of a die. All six rolls are randomized and the sum. If the sum is equal to 5, the sums counter is incremented. At the end of the loop, the sum is divided by the five dices events (which is 6^5 = 7776).