Created
May 16, 2020 20:20
-
-
Save aniruddha27/930998815e647657c75294a9b392762a 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
sample = ['statistics', 'linear algebra', 'probability'] | |
it = iter(sample) | |
while True: | |
# this will execute till an error is raised | |
try: | |
val = next(it) | |
# when we reach end of the list, error is raised and we break out of the loop | |
except StopIteration: | |
break | |
print(val) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment