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