Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python Write a program that takes a positive integer N as input and then draws N random integers in the interval [1, 6] (both ends

python image text in transcribed
Write a program that takes a positive integer N as input and then draws N random integers in the interval [1, 6] (both ends inclusive). In the program, count how many of the numbers, M, that equal 6 and write out the fraction M/N. Also, print all the random numbers to the screen so that you can check for yourself that the counting is correct. Run the program with a small value for N (e.g., N = 10) to confirm that it works as intended. Hint Use random.randint(1,6) to draw a random integer between 1 and 6. Filename: count_random_numbers.py. Remarks For large N, this program computes the probability M/N of getting six eyes when throwing a die

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

Students also viewed these Databases questions