How to use else statement in for and while loop in python
Yes, that's true we can use else statement in loops like for and else,
this is supported in python.
By using the else we can add more info to the iteration which got missed in the loop and this also works as a final statement of loops.
Below is the output for the given program
output:
Inside the loop 0
Inside the loop 1
Inside the loop 2
Inside the loop 3
Inside the loop 4
Inside the loop 5
Inside the loop 6
Inside the loop 7
out of loop