next() in Python in 30 Seconds
# confusing iterator stuff explained
Published in
3 min readMay 1, 2024
We know for loops and while loops for iteration. But did you know about next()
in Python? next()
can also be used for iterating through stuff, and here let’s explore this.
# simple for loop for iteration
fruits = ['apple', 'orange', 'pear']
for fruit in fruits:
print(fruit)
# apple
# orange
# pear