Question: AIM: Write a Python program that simulates N=100000 rolls of two six-faced dice, counts the number of times Nos of getting at least one 6

 AIM: Write a Python program that simulates N=100000 rolls of two

AIM: Write a Python program that simulates N=100000 rolls of two six-faced dice, counts the number of times Nos of getting at least one 6 from the dice rolls, and finally output the estimated probability Nos/N of getting at least one 6 from a roll of the two dice together with the theoretical value. In your program, you should first generate a NumPy array of 2N uniform random integers ranging from 1 to 6 using the random module and then reshape this array to a two-dimensional 2N array which represents the outcomes of N rolls of the two dice. Next, use this two-dimensional array with a vectorized algorithm to count the number of times of getting at least one 6 from the dice rolls. (Hint: According to probability theory, the probability of getting at least one 6 from a roll of two six-faced dice is equal to p=11/36.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!