Question: Now that you can simulate coin flips, and do it lots of times, lets try to explore the reality of coins a bit further. People

Now that you can simulate coin flips, and do it lots of times, lets try to explore the reality of coins a bit further. People generally think that getting a streak of coin flips, where the same side comes up over and over again, is extremely rare. In reality, it happens quite often. Write a function, coin_streak, that takes as input a number which is the streak length, and performs random flips until a streak of that number is achieved. The function should record the total number of flips needed to get a streak.

So, the function should look like the following:

 

Number of flips needed for streak of 10: 874

Important Note: we are using the programming language Python

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!