break statement in python in for loop code example
Example 1: python break for loop
#in Python, break statements can be used to break out of a loop
for x in range(5):
print(x * 2)
if x > 3:
break
Example 2: break function python
if( x > 3):
print('X is greater than 3')
else:
break