Loops
The while Loop
// Example
Print i as long as i is less than 6:
i = 1
while i < 6:
print(i)
i += 1The break Statement
// Example
Exit the loop when i is 3:
i = 1
while i < 6:
print(i)
if i == 3:
break
i += 1The continue Statement
The else Statement
Python For Loops
Looping Through a String
The break Statement
The continue Statement
The range() Function
Else in For Loop
Nested Loops
The pass Statement
Last updated