Answers for "how to skip next 5 iteration in python"

6

skip to next iteration in for loop python

for i in range(1,11):
    if i==5:
        continue
    print (i)
Posted by: Guest on April-14-2020
0

how to skip next 5 iteration in python

skipcount = -1
song = ['always', 'look', 'on', 'the', 'bright', 'side', 'of', 'life']
for sing in song:
    if sing == 'look' and skipcount <= 0:
        print sing
        skipcount = 3
    elif skipcount > 0:
        skipcount = skipcount - 1
        continue
    elif skipcount == 0:
        print 'a' + sing
        skipcount = skipcount - 1
    else:
        print sing
        skipcoun
Posted by: Guest on March-05-2022

Code answers related to "how to skip next 5 iteration in python"

Python Answers by Framework

Browse Popular Code Answers by Language