Question: Python: In theory the probability of randomly generating a number is determined by the set of possible numbers. Given a set pf possible numbers n

Python:

In theory the probability of randomly generating a number is determined by the set of possible numbers. Given a set pf possible numbers n the expected probability of generating any number in the set is 1/n. So the probability of rolling any one of a set of 10 numbers is expected to be 1/10.

You are to write a program that will test this theory.

Generate a random digit in the range 0 - 9 (inclusive), record the number of times that each digit 0 - 9 is thrown.You MAY NOT use 10 different variables to record the frequency

Your program should find the frequency of each digit for each number of iterations listed below:

100 1000 10000 100000 1000000

Output to the screen the frequency (as a percentage) that each digit (0 - 9) is thrown for each of the number of iterations listed above.

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!