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

2014-02-14 Thread David Hutto
Just to add a footnote to the above remember: http://en.wikipedia.org/wiki/Random_seed unless setting your own random seed algorithm is applied. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.o

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

2014-02-14 Thread David Hutto
On Fri, Feb 14, 2014 at 10:49 PM, David Hutto wrote: > 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

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

2014-02-14 Thread David Hutto
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 d

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

2014-02-13 Thread Neil Cerutti
On 2014-02-12, Steven D'Aprano wrote: > Of course attachments are "a thing" in Usenet. One of the > reasons so few ISPs offer News services these days is because > of the *huge* volume of attachments on binary news groups. Any > news client that can't at least *receive* attachments is a > major fa

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

2014-02-12 Thread Steven D'Aprano
On Thu, Feb 13, 2014 at 10:25:04AM +1100, Steven D'Aprano wrote: > On Wed, Feb 12, 2014 at 05:26:26PM -0500, Dave Angel wrote: > > The nntp news system tossed the attachments, I believe. > > If you check out the gmane.comp.python.tutor mirror, you will see the > attachments. Er, that is to say

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

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 05:26:26PM -0500, Dave Angel wrote: > He posted in html and included two attachments. His email program > added added a text version, which we know is frequently bogus. "Frequently?" I don't think so. I hardly ever see text parts which don't say the same thing as the ht

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

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 10:31:51PM +0100, spir wrote: > On 02/12/2014 10:14 PM, Steven D'Aprano wrote: > >The first thing to notice is that by the logic of the task, each flip > >must be either a Head or a Tail, so the number of Heads and the number > >of Tails should always add up to the number o

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

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 09:30:22PM +, Neil Cerutti wrote: > > Perhaps it is time for you to give up on whatever tool you are > > using to read this mailing list, or at least to change your > > assumption when you see a contentless message from "Original > > poster didn't send email" to "I can'

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

2014-02-12 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Wed, Feb 12, 2014 at 02:08:17PM -0500, Dave Angel wrote: >> Marc Eymard Wrote in message: >> > ___ >> > Tutor maillist - Tutor@python.org >> > To unsubscribe or change subscription options: >> > https://mail.py

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

2014-02-12 Thread spir
On 02/12/2014 10:14 PM, Steven D'Aprano wrote: On Wed, Feb 12, 2014 at 03:25:22PM +, Marc Eymard wrote: I want to emulate a coin flip and count how many heads and tails when flipping it a hundred times. In my last reply, I said I'd next give you some pointers to improve the code. If you'

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

2014-02-12 Thread Neil Cerutti
On 2014-02-12, Steven D'Aprano wrote: > On Wed, Feb 12, 2014 at 02:08:17PM -0500, Dave Angel wrote: >> Next time please post in text form rather than html, and >> actually include the code you're asking us to comment on. > > Dave, your tools are letting you down. Marc did post in text, and did >

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

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 03:25:22PM +, Marc Eymard wrote: > I want to emulate a coin flip and count how many heads and tails when > flipping it a hundred times. In my last reply, I said I'd next give you some pointers to improve the code. If you'd rather work on it yourself first, stop rea

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

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 03:25:22PM +, Marc Eymard wrote: > 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. The problem with the "wrong" file is that it increments the count_fla

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

2014-02-12 Thread R. Alan Monroe
> When running it, either returned values are wrong or the script > seems to enter in an infinite loop showing no return values at all. One other tip: "for" loops are usually more practical when you know exactly how many times you want to loop (100 coin flips). "while" loops are usually more prac

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

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 02:08:17PM -0500, Dave Angel wrote: > Marc Eymard Wrote in message: > > ___ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > https://mail.python.org/mailman/listinfo/tutor > > > Next

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

2014-02-12 Thread Zachary Ware
Hi Marc, On Wed, Feb 12, 2014 at 9:25 AM, Marc Eymard 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,

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

2014-02-12 Thread Alan Gauld
On 12/02/14 15:25, Marc Eymard wrote: 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. > count_heads = 0 > count_tails = 0 > count_flips = 0 > > while count_flips != 100: This is usu

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

2014-02-12 Thread Dave Angel
Marc Eymard Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > Next time please post in text form rather than html, and actually include the

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

2014-02-12 Thread R. Alan Monroe
> Can somebody explain the reason of the bug. I think you have an indentation goof on line 24 in the "wrong" version (the else clause). Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org

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

2014-02-12 Thread Marc Eymard
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 infin