Problem on while....please explain

num =1
while num < 20:
print(num%2 ,end=" ")
num += 1
output is 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1? but how?

@thaseenraza1210

Beacuse you are printing only the remainder of the value from 1 to 19.

1 Like

ohh…understood…thanks

1 Like