Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 23, 2020 04:16
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/6a2ae0413962e3b181f5199c53aabd25 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/6a2ae0413962e3b181f5199c53aabd25 to your computer and use it in GitHub Desktop.
l1=['red','green','blue']
e1=enumerate(l1)
#Returns an enumerate object which is an iterator.
print (e1)#Output:<enumerate object at 0x014894E8>
#Iterating through the iterator using next ()
print (next(e1))#Output:(0, 'red')
#both next() and obj.__next__() do the same.
print (e1.__next__())#Output:(1, 'green')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment