+ 1

How do you skip numbers in a loop?

25th Jul 2020, 12:34 PM
Abigail Bolaji
Abigail Bolaji - avatar
2 Respostas
+ 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)
25th Jul 2020, 12:37 PM
Slick
Slick - avatar