# Basic syntax:
dict_of_counts = {item:your_list.count(item) for item in your_list}
# Example usage:
your_list = ["a", "b", "a", "c", "c", "a", "c"]
dict_of_counts = {item:your_list.count(item) for item in your_list}
print(dict_of_counts)
--> {'a': 3, 'b': 1, 'c': 3}
l=[1,2,3,4,5,2,3,4,7,9,5]
l1=[]
for i in l:
if i not in l1:
l1.append(i)
else:
print(i,end=' ')
>>> your_list = ['one', 'two', 'one']
>>> len(your_list) != len(set(your_list))
True
[1, 2, 3, 4, 1, 4, 1].count(1)
# result: 3
mylist.count(element)
list_of_lists = [[] for _ in range(4)]