1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Diano4ka-milaya [45]
3 years ago
9

Write a program that performs a simulation to estimate the probability of rolling five of a kind in a single toss of five six-si

ded dice. Show your results when running 100 Monte Carlo trials, 10,000 Monte Carlo trials, and 1,000,000 Monte Carlo trials.Signature:probability_five_of_a_kind(num_trials)return typestring (formatted to show eight decimal places)Test case:>>> pro bability_five_of_a_kind(500_000)'The probability_five_of_a_kind is 0.00074000'
Computers and Technology
1 answer:
VikaD [51]3 years ago
8 0

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).

You might be interested in
Mention<br>any<br>5<br>indicators of<br>happiness​
Maru [420]

Answer:

5 indicators of happiness that might surprise you · Happiness is deep · Happy is busy · Can't buy me happiness · The happiness gene · No regrets.

Explanation:

5 0
3 years ago
Read 2 more answers
What type of organism forms the base of food webs?
kotegsom [21]
A producer <span>forms the base of food webs</span>.
7 0
3 years ago
Niall is revising a history assignment using a word processor on a Windows computer. He wants to copy a section from an earlier
Zarrin [17]

Answer:Ctrl + V

Explanation:

7 0
2 years ago
What is the main difference between cell phone and mobile phone?
vitfil [10]

Answer:

A Cell Phone is, therefore, a mobile phone that works utilizing radio cells, which is an area of radio coverage. Cell phones can typically be used while moving from one cell to another without losing coverage or dropping the connection. Satellite phones are not cell phones, although they are mobile phones.

Explanation:

8 0
3 years ago
Read 2 more answers
7.2 code practice edhesive
goblinko [34]

Answer:

Explanation:

got a 100

7 0
3 years ago
Read 2 more answers
Other questions:
  • Explain what the 35ppm specification means
    13·1 answer
  • Complete the paragraph describing characteristics of an audio mixer
    8·2 answers
  • Tools, documents, language and processes—these are examples of boundary objects. Which of the following is the best definition o
    11·1 answer
  • A(n) _________ is any system resource that is placed onto a functional system but has no normal use for that system. If it attra
    15·1 answer
  • Match the installation type to its description.
    9·1 answer
  • Why does my inbox keep getting notifications and then disappearing?
    15·2 answers
  • Which are examples of types of audio media that can support a presentation? Check all that apply.
    14·2 answers
  • The symbol located to the left of a code number that identifies a code description that has been revised is _____.
    12·1 answer
  • How many questions do you have to answer before you can use direct messages on Brainly?
    13·2 answers
  • Jamal wants to create a program that will play music during the afternoon. Which kind of loop should be used in the program?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!