-
-
Save IndhumathyChelliah/326b2acd8475078896daa62f85f4ef4c 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
l1=[1,2,3,4,5] | |
l2=iter(l1) | |
print (l2)#Output:<list_iterator object at 0x0164E658> | |
#Iterating through iterable(l1) using for loop. | |
for i in l1: | |
print (i,end=" ")#Output:1 2 3 4 5 | |
print (" ") | |
#Iterating through iterator(l2) using for loop. | |
for i in l2: | |
print (i,end=" ")#Output:1 2 3 4 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment