A break in Python stops the Statement Loop on an expression.In the example, if ‘n’ gets 7 then the iteration of for Loop stops.
Break Statement Using in Python, How to Use Break Statement In Python, Python Use Break Statement
Source Code :
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9] for n in nums : print(n) if(n == 7): break
Output :
1 2 3 4 5 6 7