i was just writing a code to count the frequencies of each element in a list and encountered an issue
please note that i know about the built-in count function but for this code im not allowed to use it
a=[1,2,4,8,2,3,4,3,1,6]
print(a)
for i in a:
count=0
for j in a:
if j==i:
count+=1
a.remove(i)
print(i,' appears ',count,' times.')
Output :
1 appears 2 times.
4 appears 2 times.
2 appears 2 times.
6 appears 1 times.
The code just didnt count 3 and 8