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
What does the following function return? void index_of_smallest(const double all, int startindex, int numberOfSlots); A. a doubl
Flauer [41]

Answer:

nothing

Explanation:

Because the return type of the function is void. void means does not return any thing.

The syntax of the function:

type name( argument_1, argument_2,......)

{

  statement;

}

in the declaration the type define the return type of the function.

it can be int, float, double, char, void etc.

For example:

int count( int index);

the return type of above function is int. So, it return integer.

similarly,

void count(int index);

it return type is void. So, it does not return any thing.

7 0
3 years ago
Kyla, a business analyst uses test scripts while testing an application before it is released to the client. Why do business ana
Mariana [72]

Answer:

D. to create a test environment

Explanation:

After releasing it will be "production"

8 0
3 years ago
How do you define a physics material?
I am Lyosha [343]

Answer:

as an object in the hierachy panel

8 0
2 years ago
Can someone give me a simple topic for a website please be creative make it simple! and fun for brainliest
forsale [732]

Answer:

hmm you could talk about your dailylife , or stuff you like to do etc do what you like <3 , if you like art you could do that to!

Explanation:

Can someone give me a simple topic for a website? please be creative make it simple! and fun for brainliest

3 0
2 years ago
Which kind of results will appear using the search query "Frosty the Snowman" in quotation marks?
Citrus2011 [14]
The correct Answer is B
6 0
3 years ago
Other questions:
  • What must you do first in order to change the font type size and colour of a particular text
    13·2 answers
  • The following 2D array has been created:
    12·2 answers
  • The United States is the only country in the world in which organs and tissue transplants are performed. True or False?
    8·1 answer
  • True or false.the color attribute cannot recognized the hexadecimal code.
    7·2 answers
  • Bluetooth © and Wifi are two examples of transmission protocols. Which of the following statements about them is true?
    9·1 answer
  • What is the subnet mask ?
    9·2 answers
  • Multiple Choice: We have been assigned the task of developing a software testing tool (tester) that can assess reachability of s
    11·1 answer
  • Ben is writing a paper for his college history class, and he wants to include some information he found on a Web site. What are
    5·1 answer
  • How would you assign roles to your group members?
    9·2 answers
  • The Internet is a worldwide communications network. Which device connects computer networks and computer facilities?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!