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.


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


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