Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Explain what a patent is and describe different types of patents.

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago