Hey, @Vishal,
Python provides two keywords that terminate a loop iteration prematurely:
-
The Python break statement immediately terminates a loop entirely. Program execution proceeds to the first statement following the loop body.
-
The Python continue statement immediately terminates the current loop iteration. Execution jumps to the top of the loop, and the controlling expression is re-evaluated to determine whether the loop will execute again or terminate.
Could you please provide your code snippet so that I can demonstrate to you where you should use break to terminate the loop?