0
How to traverse list,tuple and string
Function
1 Answer
+ 5
You can iterate over list, tuple or string by using a for loop.
lst = [1,2,3,6,2,5]
for i in lst:
# do something with i
the for loop picks one item in list in each iteration. This item is stored in i. The loop will continue until no more items can be found in lst.