[Tutor] Fwd: Re: While Loop Question
Rafael Skovron
rskovron at gmail.com
Thu May 11 15:55:52 EDT 2017
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 <
arj.python at gmail.com> 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" <arj.python at gmail.com>
> wrote:
>
> >
> >
> > ---------- Forwarded message ----------
> > From: "Abdur-Rahmaan Janhangeer" <arj.python at gmail.com>
> > Date: 11 May 2017 12:26 pm
> > Subject: Re: [Tutor] While Loop Question
> > To: "Rafael Skovron" <rskovron at gmail.com>
> > 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 - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list