Question: Help !! Write the function probabilityHead that takes an integer n, flips a coin n times, counts the number of heads, and returns the proportion

Help !! Help !! Write the function probabilityHead that takes an integer n, flips

Write the function probabilityHead that takes an integer n, flips a coin n times, counts the number of heads, and returns the proportion of flips that are heads (a value between 0 and 1). For example, if 49 of 100 flips are heads, you would return .49. You can use my last flip function from lecture 5 or or one of the flip functions that you designed above. Sample input n=100 Possible output .49 Note that randomization is being used, so the output is not totally predictable (although trends can be observed). Compute the proportion for n=10,n=100,n=1000, and n=1000000. What do you observe as n increases? (Write as a text cell under the 4 experiments.) Since this is a random experiment, try it again and see if the trend is repeated. What would you expect to happen as n increases? (Write as a text cell under the 4 experiments.)

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!