While Loop, Break & Continue – Python Programming
What is a Loop
The While Loop
The code that will run for each iteration of the loop is written in the indented block. The working is very simple. Initial values of variable i is 1, x is 10. Therefore, the first time the loop runs, the condition is very well satisfied and the code in the indented block runs, it prints out the value of I i.e 1. It then increments the value of I from 1 to 2(i+=1). This continues until the value of I becomes 11. Now the condition will fail and the loop will stop executing. The output for the same should be as follows.
Break and Continue
Here we will be using the continue keyword.