Python break explanation example: Here, we will figure out how to utilize break articulation in the circles in Python?
the break is a watchword in python simply like another programming language and it is utilized to break the execution of circle explanation.
In the given example, the circle is running from 1 to 10 and we are utilizing the break explanation if the estimation of I is 6. Hence when the estimation of I will be 6, the program’s execution will turn out from the circle.
for i in range(1,11): if(i==6): break print(i)
1 2 3 4 5
Example 2: In this example, we are printing character by character of the worth/string “Hi world” and ending (utilizing break), if the character is space.
for ch in "Hello world": if ch == " ": break print(ch)
H e l l o