The break statement enables a program to skip over a part of the code. A break statement terminates the very loop it lies within.
syntax where we use for loop and break:-
for variable in sequence: statement1 if expression: break statement2 statement3
syntax where we use while loop and break:-
while expression1: statement1 if expression2: break statement2 statement3
e.g.,
for a in "python": if a == "h": break print(a)
Output- p y t
This is all about break in python.