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
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