Re: [Tutor] While Loop Question

2017-05-11 Thread George Fischhof
2017-05-11 3:53 GMT+02:00 Rafael Skovron : > Sorry I left out the indents in my previous email. It seems like j is > always reset to zero. Why does j vary? > > Are there two different instances of j going on? > > > for i in range(1, 5): > > j=0 > >while j < i: > > print(j, end = "

Re: [Tutor] While Loop Question

2017-05-11 Thread Steven D'Aprano
On Wed, May 10, 2017 at 06:53:21PM -0700, Rafael Skovron wrote: > Sorry I left out the indents in my previous email. It seems like j is > always reset to zero. Why does j vary? Because you run code that adds 1 to j. > Are there two different instances of j going on? No. Try to run the code in y

[Tutor] While Loop Question

2017-05-11 Thread Rafael Skovron
Sorry I left out the indents in my previous email. It seems like j is always reset to zero. Why does j vary? Are there two different instances of j going on? for i in range(1, 5): j=0 while j < i: print(j, end = " ") j += 1 ___