Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started