I want to create a new list with non-repetitive spelling of the elements and a new list with the number of repeats.
Like this
list=["jim","jennifer","roy","roy","mike","jim","roy","jim",mike","roy"]
I want to create 2 lists like these:
list1=["jim","jennifer","roy","mike"]
containing the unique elements oflist
list2=[3,1,4,2]
containing the number of occurrences of each unique element.
I tried to this
number_of_repeats=[]
for i in range(len(list)):
number_of_repeats.append(list.count(list[i]))
This give me
number_of_repeats=[3,1,4,4,2,3,4,3,2,4]
How can I get output like list1 and list2?