-
-
Save IndhumathyChelliah/2bad88dcc9272edbe7d7b894eb1680db 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
#dictionary | |
a={'a':1,'b':2,'c':3} | |
#Converting dictionary(iterable) into iterator object using iter() function. | |
b=iter(a) | |
print (b)#Output:<dict_keyiterator object at 0x005F3BE0> | |
print (type(b))#Output:<class 'dict_keyiterator'> | |
#Applying next() over the iterator. | |
#Returns one element(key) at a time. | |
#loops over the keys in the dictionary | |
print (next(b))#Output:a | |
print (next(b))#Output:b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment