[Tutor] Beginner - explaining 'Flip a coin' bug

David Hutto dwightdhutto at gmail.com
Sat Feb 15 04:49:43 CET 2014


Here is a problem I've come across, from empirical evidence, that also
relates to your equation. We always assume
 that their are always two probabilities, that a coin can be either head or
tails.

However, there are dynamics within a third realm of the dimensionality of
the coin...it's not a two dimensional plane. So the planar probabilities in
relation to the 'surface are' hold another possibility...the 'edge'.

The algorithm of applying the edge are up to you, but I've seen the coin
land on it's curved edge more than once, so this function you've designed,
should have more than two possibilities, within a complete algorithm to the
real world functionality of the coin in question.


On Wed, Feb 12, 2014 at 10:25 AM, Marc Eymard <marc_eymard at hotmail.com>wrote:

> Hello there,
>
> I want to emulate a coin flip and count how many heads and tails when
> flipping it a hundred times.
>
> I first coded *coinflip_WRONG.py* with "count_flips += 1" statement
> within the *if/else* block.
> When running it, either returned values are wrong or the script seems to
> enter in an infinite loop showing no return values at all.
>
> *coinflip.py* is a corrected version I worked out myself. I moved
> "count_flips+= 1" out of *if/else* block and inserted it before* if/else*.
>
> However, I still don't understand the bug since, in my understanding, both
> files are incrementing variable *count_flips* each time until the loop
> becomes false.
>
> Can somebody explain the reason of the bug.
> Cheers,
>
> Marc
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Best Regards,
David Hutto
*CEO:* *http://www.hitwebdevelopment.com <http://www.hitwebdevelopment.com>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140214/f813ef8c/attachment.html>


More information about the Tutor mailing list