Python break statement is used when you need to break the current loop completely, it mean no further iterations will be done for the current loop.
Consider below example, when the value of counter becomes 5, the if condition is True, which triggers the break statement, hence, no further iterations are carried out, the loop is broken or stopped, hence values only till 4 are printed.
1 2 3 4 5 6 7 8 9 |
counter=1 while counter < 10: # Evaluating the condition if(counter==5): counter += 1 break else: print(counter) counter += 1 |
Sample Output:

When there are nested loops, then the loop where break statement is called, that loop is stopped. In this example shown below, every time the character ‘c’ is encountered, the break statement executes, hence the rest of the inner loop doesn’t execute and the control moves to outer loop.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# Another example of break statement # Creating sample objects sampleList=[10,20,30,40] sampleTuple('a','b','c','d') # Nested for loop for multiple iterators for numIterator in sampleList: for charIterator in sampleTuple: # Completely break the current loop if 'c' is encounterd if(charIterator=='c'): break print(numIterator, '--', charIterator) |
Sample Output:

Author Details
Lead Data Scientist
Farukh is an innovator in solving industry problems using Artificial intelligence. His expertise is backed with 10 years of industry experience. Being a senior data scientist he is responsible for designing the AI/ML solution to provide maximum gains for the clients. As a thought leader, his focus is on solving the key business problems of the CPG Industry. He has worked across different domains like Telecom, Insurance, and Logistics. He has worked with global tech leaders including Infosys, IBM, and Persistent systems. His passion to teach inspired him to create this website!