[Tutor] Fwd: Re: While Loop Question

Abdur-Rahmaan Janhangeer arj.python at gmail.com
Thu May 11 04:29:09 EDT 2017


---------- 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


More information about the Tutor mailing list