Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

a neglect of quality in relationship to international competitors;

Answered: 1 week ago