+ 1
How do you skip numbers in a loop?
1 Antwort
+ 5
Using "continue" is one way
Lets say i want to print evens
for i in range(11):
if i % 2 == 1:
continue
print(i)
Another is just leaving what you dont want out
for i in range(11):
if i % 2 == 0:
print(i)