0% found this document useful (0 votes)
2 views1 page

plot_PDF

The document outlines a program that simulates flipping a coin a specified number of times and calculates the longest streak of heads over multiple trials. It provides data on the average longest streak for various flip counts, showing that as the number of flips increases, the average longest streak also increases. A plot is suggested to visualize these results.

Uploaded by

zhangclaire2010
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

plot_PDF

The document outlines a program that simulates flipping a coin a specified number of times and calculates the longest streak of heads over multiple trials. It provides data on the average longest streak for various flip counts, showing that as the number of flips increases, the average longest streak also increases. A plot is suggested to visualize these results.

Uploaded by

zhangclaire2010
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Plot Summer 2026

5 . 1 . 17

Longest Streak

In this program we are going to extend the Coin Flips program from earlier.

Now we will simulate flipping a coin FLIPS times, printing out the result of each flip
(either “Heads” or “Tails”), but at the end we will print out the longest streak of heads.

For example, if we set FLIPS = 10; a run may output the following:

Heads
Heads
Tails
Heads
Tails
Tails
Heads
Heads
Heads
Heads
Longest streak of heads: 4

If we flipped a coin ten (10) times would the longest streak always be four? Over a
hundred trials what would be the longest streak on average?

If we flipped a hundred times instead, over a hundred trials, what would be the longest
streak on average?

If we flipped two hundred times? Three hundred? A thousand, over a hundred trials?

Calculate the average longest streak over a hundred trials for each number of flips.

Number of flips 100 200 300 400 500 600 700 800 900 1000

Average longest streak 6.0 6.89 7.7 7.88 8.29 8.5 8.81 9.05 9.25 9.34

Plot the results.

<plot>

END

You might also like