[Tutor] Splitting a string

Alan Gauld alan.gauld at btinternet.com
Wed Feb 9 13:35:51 CET 2011


"tee chwee liong" <tcl76 at hotmail.com> wrote 

t> hanks for catching the bug. the code should be:
> s='11100101'
> found = False
> for i,c in enumerate(reversed(s)):
>    if c == '0':
>        print 'Lane fail',i
>        found = True
>        if not found: print 'All lanes PASS'
> 
> the if not found needs to be indented. 

No, exactly the opposite - the last line needs to 
be ex-dented. ie taken out of the loop.
Take a look at my original post.

Alan G.



More information about the Tutor mailing list