Question: 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
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 2xN 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.
Step by Step Solution
There are 3 Steps involved in it
Below is a Python program that simulates N100000 rolls of two sixfaced dice counts the number of tim... View full answer
Get step-by-step solutions from verified subject matter experts
