#continue moves to the next iteration - in the example below when num == 4, 'Found!' will be printed and it will skip print(num) and go to the next iteration of the loopfor num in nums:
if num == 4:
print('Found!')
continueprint(num)
1
2
3
Found!
5
Break Example
#break, breaks out of the loopfor num in nums:
if num == 4:
print('Found!')
breakprint(num)
1
2
3
Found!
Nested For Loop Example
#loop within a loopfor num in nums:
for letter in'abc':
print(num, letter)
1 a
1 b
1 c
2 a
2 b
2 c
3 a
3 b
3 c
4 a
4 b
4 c
5 a
5 b
5 c
For Loop Range Example
#run through a loop ten timesfor i inrange(10):
print(i)
0
1
2
3
4
5
6
7
8
9
For Loop Range with Starting Point Example
# run through to ten starting at 2for i inrange(2, 11):
print(i)