Skip to content

Coin Flip Hw#3

Open
pnitto wants to merge 1 commit intotiy-gvl-python:masterfrom
pnitto:master
Open

Coin Flip Hw#3
pnitto wants to merge 1 commit intotiy-gvl-python:masterfrom
pnitto:master

Conversation

@pnitto
Copy link

@pnitto pnitto commented Jun 10, 2015

Coin Flip

@taddeimania
Copy link
Member

I think this was the code you were putting together to calculate ratios:

zipped = zip(heads, tails)
for heads, tails in zipped:
    print(heads / tails)

Most of your values were returning as .9 or 1.000~

This is because most of the heads counts were nearly equal to the tails counts. Our intuition says that means that nearly half of the flips came up heads, the other half came up tails - but why is the "ratio" at 1 or .9? Because the ratio needs to be more like heads / (heads + tails) so you will get a comparison of how the heads flips compared to the total amount of flips.

What the code heads / tails is actually saying is "tell me how much more or less head flips than there were tails flips". So a result of 1.01 will say "there was 1% more heads flips than tails" or a .98 would says "there were 2% less head flips than tails". This is not really what we are wanting. We want to know "of the total amount of coin flips, how many were heads?"

So to do that you'd compare the amount of heads occurences vs. the total count of flips. That way you'd see values like .51 or .49 - thus saying "50% of flips came up heads" or "49% of flips came up heads".

Hope this clarifies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants