Hi David,

Thanks for your input about the logic of this little script of mine.

I confess I omitted the edge possibility and assumed heads or taisl only.

As I progress further with getting the foundation knowledge of the language 
itself, it is really appreciated to be corrected on what good programming is 
about regardless of the language.

Please keep commenting/helping whenever necessary.

Cheers,
Marc

Date: Fri, 14 Feb 2014 22:49:43 -0500
Subject: Re: [Tutor] Beginner - explaining 'Flip a coin' bug
From: dwightdhu...@gmail.com
To: marc_eym...@hotmail.com
CC: tutor@python.org

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_eym...@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@python.org

To unsubscribe or change subscription options:

https://mail.python.org/mailman/listinfo/tutor




-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to