Reputation: 13
Wondering how would the following for loop be changed to while loop.
While having the same output.
for i in range(0,20, 4):
print(i)
Upvotes: 0
Views: 66
Reputation: 1124
It will be something like this:
i = 1
while i < 20:
print(i)
i += 4
you can also visit here for more info: https://www.w3schools.com/python/python_while_loops.asp
Upvotes: 0