Created
July 5, 2024 16:10
-
-
Save 2tony2/09a98ec19cb5dc5dea49c8e7fb496cba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_list = [1, 2, 3] | |
iterator = iter(my_list) | |
print(next(iterator)) # Output: 1 | |
print(next(iterator)) # Output: 2 | |
print(next(iterator)) # Output: 3 | |
# Calling next again will raise a StopIteration Exception |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment