Search This Blog

Wednesday, 15 December 2021

Continue statement in Python

 

Python Continue Statement

html site templates

Python Continue Statement is a jump statement which is used to skip execution of current iteration. After skipping, loop continue with next iteration. We can use continue statement with for as well as while loop in Python

Continue Statement :

Python Continue Statement Example :

a=0

while a<=5:
    a=a+1
    if a%2==0:
        continue
    print a
print "End of Loop"

output of above example  :

1
3
5
End of Loop

You can use the continue statement to avoid deeply nested conditional code, or to optimize a loop by eliminating frequently occurring cases that you would like to reject.

The continue statement causes a program to skip certain factors that come up within a loop, but then continue through the rest of the loop.

No comments:

Post a Comment

how to implement YOLOv3 using Python and TensorFlow

Object Detection with YOLOv3 Introduction YOLOv3 (You Only Look Once version 3) is a real-time object detection algorithm that can detect ob...