Answers for "how to print the next item in a list python '"

0

python next item in list

# credit to Stack Overflow user in the source link

from itertools import cycle

li = [0, 1, 2, 3]

running = True
licycle = cycle(li)

nextelem = next(licycle)

while running:
    thiselem, nextelem = nextelem, next(licycle)
Posted by: Guest on May-27-2021

Code answers related to "how to print the next item in a list python '"

Python Answers by Framework

Browse Popular Code Answers by Language