demo_ref_next.py:
mylist = iter(["apple", "banana", "cherry"]) x = next(mylist) print(x) x = next(mylist) print(x) x = next(mylist) print(x)
C:\Users\My Name>python demo_next.py
apple
banana
cherry