Nested For and While Statements

James Stroud jstroud at mbi.ucla.edu
Mon Sep 24 15:49:55 EDT 2007


koutoo at hotmail.com wrote:
> I start my code with some constants then a while statement.  But I
> have some For statements towards the end within the While statement
> where I start getting some errors.  I'm hoping I won't have to post my
> code, but it looks something like this:
> 
> Import os, string
> 
> while this:
> 
>      All Code indented like it should
> 
> 
>      Last line in While.
> 
>            For i in range(1)
>                 class = []
>                 class2 = []
>                 For i in range(2)
>                      Do this
>                      And this
>                      And that.
> 
>                      Next Line hits snag here?  Where should this line
> be?
> 

Your for loops both use the same counting index.



More information about the Python-list mailing list