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]
2 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]2 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
A frame size of 2048 × 1536.
Anon25 [30]
The answer is: 3,145,728 bytes
3 0
3 years ago
Read 2 more answers
What’s the best way to figure out what wires what and goes where?
igor_vitrenko [27]
Try to untangle them, First!
Then the color of the wire must match the color hole it goes in (I’m guessing)
I’m not good with electronics so sorry.
6 0
3 years ago
Not all output display data for humans to read explain why​
Vadim26 [7]

Answer:

The eye has a very focused view that is optimised for perceiving movement.Human cannot see clearly outside an -5 degree cone of foveal vision.

8 0
2 years ago
Show two ways of bracketing an exposure of f/16 at 1/125 shutter speed. (Copy the two lines below and fill in the blanks for the
Eva8 [605]

Answer:

Explanation:

If we use bracketing, we must take three pictures of the same place, but we must take it with different exposures.

In this particular example we have an exposure of f/16 at 1/125 shutter speed, first we must take underexposed picture with exposure of f/22 at 1/125 shutter speed or exposure of f/16 at 1/400 shutter speed, then we take an overexposed picture with exposure of f/8 at 1/125 shutter speed or exposure of f/16 at 1/50 shutter speed.

The last step is taking the three pictures and use the option bracketing in an editing photo tool, there are cameras that have this option to take 3 pictures automatically.

4 0
3 years ago
9.6 Code practice Edhesive
Oxana [17]

Answer:

N = [1,1,1,1,1],

[2,2,2,2,2],

[3,3,3,3,3],

[4,4,4,4,4]

def printIt(ar):

   for row in range(len(ar)):

       for col in range(len(ar[0])):

           print(ar[row][col], end=" ")

       print("")

           

N=[]

for r in range(4):

   N.append([])

   

for r in range(len(N)):

   value=1

   for c in range(5):

       N[r].append(value)

       value=value + 1

           

printIt(N)

print("")

newValue=1

for r in range (len(N)):

   for c in range(len(N[0])):

       N[r][c] = newValue

   newValue = newValue + 1

       

printIt(N)

Explanation:

I got 100%.

7 0
2 years ago
Other questions:
  • An undesirable jagged appearance is referred to as
    7·2 answers
  • Which piece of code results in the following? Italics
    15·1 answer
  • CNG and gasoline-powered vehicles use the same internal combustion engine, but different fuel types. A) True B) False
    8·2 answers
  • When a private network uses a single public ip address, and each outgoing tcp packet uses a different port to allow for proper t
    15·1 answer
  • To edit the color of the text in presentation software, choose the Font color command Text Color in the ________ ribbon toolbar.
    15·2 answers
  • You are evaluating the bounce rate of your overall website traffic and find that users with a social media referral source have
    9·1 answer
  • What method of the String object searches the string for an occurence of the specified search string?
    9·1 answer
  • Piecewise functions are sometimes useful when the relationship between a dependent and an independent variable cannot be adequat
    12·1 answer
  • Examples of 15 viruses in computer
    10·1 answer
  • processing C. have only one function, e.g. control traffic lights in a town, games machines 7 To create a formula, you first: A.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!