How to Stop Current Iteration of Loop in Python


In this example, we will learn how to stop the current iteration of the loop and continue with the next in Python.

Source Code

str = 'abcdc'
for x in str:
    if x == 'c':
        continue
    print(x)

Output:

a
b
d
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement