Saint Louis University |
Computer Science 1300/5001
|
Computer Science Department |
Please make sure you adhere to the policies on academic integrity.
Consider a single experiment of flipping a fair coin until an outcome of "heads" and counting the number of flips that occur. Note well that randrange(2) will return either 0 or 1, with equal probability.
Write a for loop that repeats 10,000 trials of this experiment, reporting
For example, my program output the following for a 10,000 trial experiment:
Average number of flips 2.0142 Maximum number of flips 17
Of course, since randomness is involved, another such experiment would presumably get different results.
In submitting this homework, please give us the source code you use for the analysis, as well as sample output for one run of your program.