☞ It can be done in two ways.
1. Using Index 2. Without Using Index
☞ Using Index
Example 1 :#Traversing a list using for loop
L = [10, 20, 30, 40]
for i in range(len(L)):
print(L[i])
10 20 30 40
#Traversing a list using while loop
L = [10, 20, 30, 40]
i = 0
while i < len(L):
print(L[i])
i = i + 1
10 20 30 40
☞ Without Using Index
Example :L = [10, 20, 30, 40] for i in L: print(i)
10 20 30 40