Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 !! image text in transcribed
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

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

Students also viewed these Databases questions