We have to take input of the length of the list from the User. Then count the frequency of each element in the list and print them using python.
I tried and here is the code :
l =  []
n = int(input("Enter the length of list : "))
for i in range(0,n):
    l.append(int(input("Enter an element : ")))
count = 0
for i in range(len(l)):
    for j in range(len(l)):
        if (l[i] == l[j]):  #Error
            count = count + 1
            l.pop(j)
    else:
        print("Count of ",l[i]," is ",count)
        count = 0
        l.pop(i)
else:
    print(l)
Getting error :
line 8, in if (l[i] == l[j]): IndexError: list index out of range
 
     
    