Last active
November 22, 2017 12:17
-
-
Save erikaris/000a9a562ce0e412616d7ccf5587f2f9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
mystr = "erika" | |
for s in mystr: | |
print(s, end=" ") | |
it = iter(mystr) | |
print("\n", it) | |
print(next(it)) # the next() function returns the next value and advances the state | |
print(next(it)) # the next() function returns the next value and advances the state | |
print(next(it)) # the next() function returns the next value and advances the state | |
print(next(it)) # the next() function returns the next value and advances the state | |
print(next(it)) # the next() function returns the next value and advances the state | |
print(next(it)) # next() raises StopIteration to signal that iteration is complete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment