Python Break Statement

Python Break Statement terminates the current loop and resumes execution at the next statement, just like the traditional break statement in C.

If you need to exit a loop early, then you can use the break keyword. This keyword will work in both for and while loops. The most common use for break is when some external condition is triggered requiring a hasty exit from a loop.

Example:

for letter in 'ProgramBuzz':    
    if letter == 'g':
        break
    print ('Current Letter :', letter)

Output: 

Current Letter : P
Current Letter : r
Current Letter : o

Tags