Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 23, 2020 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/96e4de16ddf3853025feba04721fa208 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/96e4de16ddf3853025feba04721fa208 to your computer and use it in GitHub Desktop.
l1=[1,2,3]
l2=iter(l1)
print (next(l2))#Output:1
print (next(l2))#Output:2
print (next(l2))#Output:3
#Once the iterator is exhausted, next() function raise StopIteration.
print (next(l2))#Output:StopIteration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment