Iterators¶ Iterators provide a way to access elements of a collection sequentially without exposing the underlying structure 1numbers = [1, 2, 3, 4, 5, 6] 1 2iterator = iter(numbers) # Lazy loading of the list iterator <list_iterator at 0x7f80ec343fd0> 1 2print(next(iterator)) print(next(iterator)) 1 2 1 2 3 4 5 6 7numbers = [1, 2, 3, 4, 5, 6] iterator = iter(numbers) try: while True: print(next(iterator)) except StopIteration: print("Reached the end of the iterator.") 1 2 3 4 5 6 Reached the end of the iterator.