x = [20, 6, 99, 3, 6, 2, 1,11,41, 31, 99, 6, 7, 8, 99, 10, 99 ,6]
y =[]
for j in x:
y[j]+=1
I want to count the occurrence of the list values in x. I get an error when I try to do that using the above code. what is wrong In my code?
I am new to programming so kindly explain it in simple terms.
my desired output is a list that contains the number of occurences of the values in x
.