Consecutive Character Sequences

Sion Arrowsmith siona at
Thu Jul 14 16:08:36 CEST 2005

Aries Sun <sun.aries at> wrote:
>I used Python 2.4.1, the following are the command lines.
>But the reslut was still False. Is there anything wrong with below
>>>> import itertools as it
>>>> def hasConsequent(aString, minConsequent):
>	for _,group in it.groupby(aString):
>		if len(list(group)) >= minConsequent:
>			return True
>		return False

Yes: return False is at the wrong indentation level.

\S -- siona at --
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

More information about the Python-list mailing list