Re: [Tutor] Finding the streaks in heads/tails list

2008-10-03 Thread nathan virgil
You need to store the count before resetting it since you want to know the largest value of count over the list. Or at least keep a separate max variable that you update if count max. Fairly easy: if Cur_Count Max_Count: Max_Count = Cur_Count See? Just two extra lines of code.

[Tutor] Finding the streaks in heads/tails list

2008-10-01 Thread Alec Henriksen
Hello, I thought it'd be cool to write a program for my logic/critical thinking class, and right now we're evaluating randomness - and the deception of it. A previous post inspired it - coin flipping. So, I've written a program that flips a coin 1000 times and records it all in a dictionary,

Re: [Tutor] Finding the streaks in heads/tails list

2008-10-01 Thread Kent Johnson
On Wed, Oct 1, 2008 at 4:56 PM, Alec Henriksen [EMAIL PROTECTED] wrote: Hello, I thought it'd be cool to write a program for my logic/critical thinking class, and right now we're evaluating randomness - and the deception of it. A previous post inspired it - coin flipping. So, I've written a

Re: [Tutor] Finding the streaks in heads/tails list

2008-10-01 Thread Danny Yoo
Regular expressions are for processing strings, not loops. From a theoretical point of view, this isn't quite true: regular expressions can deal with sequences of things. It's true that most regular expression libraries know how to deal only with characters, but that's a matter of specializing

Re: [Tutor] Finding the streaks in heads/tails list

2008-10-01 Thread Kent Johnson
On Wed, Oct 1, 2008 at 6:00 PM, Danny Yoo [EMAIL PROTECTED] wrote: Regular expressions are for processing strings, not loops. From a theoretical point of view, this isn't quite true: regular expressions can deal with sequences of things. Sheesh! OK, *Python* regular expressions are for

Re: [Tutor] Finding the streaks in heads/tails list

2008-10-01 Thread Alan Gauld
Kent Johnson [EMAIL PROTECTED] wrote What I want to do, is find out the largest streak of digits. In the above example, the streak would be 5, because there are 5 tails flips in a row. I would loop through the list with a for loop, keeping track of the last value seen and the current