Python For Break is used to stop the loop before it has looped through all the items. For that, you have to use the if statement to match the break loop condition.
Python for break example
Simple example code exit for a loop if the value is “apple“.
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
if x == "apple":
print("Break Loop")
break
Output:

Another Example
for x in range(1, 10):
print(x)
if x == 4:
break
Output:
1
2
3
4
Do comment if you have any doubts and suggestions on this Python break keyword.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.