Example & Tutorial understanding programming in easy ways.

What is the purpose of the break statement in Python ?

In every programing language, the break statement is used to exit the running loop.

Example:

for i in range(4):

    if i==2:

        print("We exit from loop at i=",i)

        break


//output:

We exit from loop at i=2

Read More →