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
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