loop on list python code example
Example 1: how to loop over list
list = [1, 2, 3, 4, 5, 6]
for item in list:
print(item)
for index in range(len(list)-1):
print(list[index])
for index, value in enumerate(list):
print(value)
Example 2: python iterate list
lst = [10, 50, 75, 83, 98, 84, 32]
for x in range(len(lst)):
print(lst[x])
Example 3: how to iterate over a list in python
lst = [10, 50, 75, 83, 98, 84, 32]
res = list(map(lambda x:x, lst))
print(res)
Example 4: python iterate through list
for row in list: