Traversing a linear list
Traversing involves processing of all elements one by one upto the last element.
Steps for traversing a list :-
1. Create an empty list
2. Take input for size of the list of the list(total no. of elements)
3. Using a for loop or while loop take input for the elements of the list.
4. For traversing or displaying all the elements use a for loop.
#Creating and traversing a linear list print("creating a Linear list") size=int(input("enter the size of the linear list: ")) ar=[] i=0 while(i<size): n=int(input("enter element :")) ar.append(n) i=i+1 print("traversing the list") i=0 while(i<size): print(ar[i],end=' ') i=i+1