how to break and continue in python for loop and if else code example
Example 1: python continue
for i in range(10):
if i == 3: # skips if i is 3
continue
print(i)
Example 2: break python
# Use of break statement inside the loop
for val in "string":
if val == "i":
break
print(val)
print("The end")
---------------------------------------------------------------------------
s
t
r
The end