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
Who has gotten a random file link from someone? What file does it contain?
Bad White [126]

Answer:

those are bots , just report those

Explanation:

8 0
3 years ago
Read 2 more answers
What do these terms have in common? google, yahoo!, bing they are important books. they are internet search engines. they are wo
Vlada [557]
They are Internet search engines.
7 0
4 years ago
Sally needs to teach her class how to convert a decimal number to a binary number. What is the first step she should take to sta
Alborosie

<u>Answer:</u>

  • <em>A. divide the decimal number by the base value 2</em>
  • <em>C. note the remainder separately</em>
  • <em>D. divide by 2 until she gets 0 as the remainder</em>
  • <em>B. collect the digits in the reverse order</em>

<u>Explanation:</u>

When we want to convert decimal number to a binary number first we have divide the given number by 2. The next step is to note the reminder of the number in the side every division so that the reminder value is the binary value. Repeat this until an zero is encountered.

We have to collate all the remainders from last of first and then the collated number is the answer for the given problem.

<em>So the given option can be ordered as, </em>

  • <em>A</em>
  • <em>C</em>
  • <em>D</em>
  • <em>B</em>
6 0
4 years ago
A cybercrime: Select one: a. Is the act of defaulting on a properly signed agreement entered into upon the internet. b. Can be c
aalyn [17]

The answer is B because cyber crime is when a computer is used to commit criminal activities.

3 0
4 years ago
Which of the following would most likely happen if cost were a constraint during the design process of a new product?
Dmitry_Shevchenko [17]
The answer would be “A”
8 0
3 years ago
Read 2 more answers
Other questions:
  • Use the following business rules to assign name to the tables on the ERD: Note: These rules are in the context of a small retail
    7·1 answer
  • Find Multiplication of Binary Numbers: 1100112 x 10012
    9·1 answer
  • When you set the position property for a block element to absolute, the browser?
    8·1 answer
  • Which statement does not describe the guidelines for the use of text in presentation programs?
    7·1 answer
  • 2. An evil twin attack that broadcasts a legitimate SSID for an unauthorized network is an example of what category of threat? A
    9·1 answer
  • Social media is an effective form of e-commerce. True False
    12·1 answer
  • In a period of steep increases in interest rates, which issuer is most likely to be negatively affected? A Trucking company B Ut
    9·2 answers
  • You want to substitute one word with another throughout your document. What tool(s) should you use?
    9·1 answer
  • describe the role and importance of computers in New Media. Prepare a report on increasing interest and impact of mobile phones
    9·1 answer
  • To reposition the legend to the left-hand side of a chart, click the _________ button, point to legend, click the right arrow ic
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!