+ 1
Python While loops
When I try to write this code in Jupyter it does not print anything, does anyone know why? x = 0 while x<= 20 : print(x) x += 2
2 odpowiedzi
+ 5
you need to make sure that your indentation is correct, it's very critical in python.
x = 0
while x <= 20:
print(x)
x += 2
by the way it would be easier to just use a for-loop for this task:
for x in range(0, 21, 2):
print(x)
+ 1
Thank you very much!