Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created Jul 23, 2020
Embed
What would you like to do?
#Tuple
a=(1,2,3,4,5)
#Converting tuple(iterable) into iterator object using iter() function.
b=iter(a)
print (b)#Output:<tuple_iterator object at 0x015DE610>
print (type(b))#Output:<class 'tuple_iterator'>
#Applying next() over the iterator.
#Returns one element at a time.
print (next(b))#Output:1
print (next(b))#Output:2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment