Thank you all I finally understood that the while code traps j and runs independently of the for loop until while is false and a new i is picked.
On Thu, May 11, 2017 at 10:19 AM Abdur-Rahmaan Janhangeer < [email protected]> wrote: > sorry j is set to zero. grave typo > > Abdur-Rahmaan Janhangeer, > Mauritius > https://abdurrahmaanjanhangeer.wordpress.com > > On 11 May 2017 12:29 pm, "Abdur-Rahmaan Janhangeer" <[email protected]> > wrote: > > > > > > > ---------- Forwarded message ---------- > > From: "Abdur-Rahmaan Janhangeer" <[email protected]> > > Date: 11 May 2017 12:26 pm > > Subject: Re: [Tutor] While Loop Question > > To: "Rafael Skovron" <[email protected]> > > Cc: > > > > i modified your code to make it look like that : > > > > for i in range(1, 5): > > > > j=0 > > print("outer, i=",i) > > while j < i: > > print("inner, j=",j) > > > > j += 1 > > > > so it shows that each time the outer loop is reexecuted, i is set to > zero. > > > > putting j at the begining completely, it is not reset to zero > > > > Abdur-Rahmaan Janhangeer, > > Mauritius > > https://abdurrahmaanjanhangeer.wordpress.com > > > > > > > > > _______________________________________________ > Tutor maillist - [email protected] > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
