Syntax: Select all
while i < len(list):
top = list[i][0]
s = 0
c = 0
while s < len(list):
if top == list[s][0]:
c = c + 1
s = s + 1
count.append(c)
r=r+c
Here I have a list called 'list'
Its contents are:
[['aaa','a','ssssss'], ['ddd','a',ssss']]
I want to count occurenec of each element in the lists.I ran the above code but I got an error saying list out of range.Can anyone solve this???