# 方法一
List =[1,2,2,3,3,3,4,4,4,4,5,5,5,5,5]
Strlist=['A','B','B','C','C','C','D','D','D','D']
a=set(List)
b=set(Strlist)
print(List)
print(Strlist)
print(a)
for i in a:
count =List.count(i)
print(i,'出现的次数:',count)
for i in b:
count =Strlist.count(i)
print(i,'出现的次数:',count)
print('-'*20)
#方法二
List =[1,2,2,3,3,3,4,4,4,4,5,5,5,5,5]
Strlist=['A','B','B','C','C','C','D','D','D','D']
d1 = {}
d2 = {}
for i in List:
if List.count(i) >= 1:
d1[i] = List.count(i)
print(d1)
for i in Strlist:
if Strlist.count(i) >= 1:
d2[i] = Strlist.count(i)
print(d2)
print('-'*20)
#方法三
from collections import Counter
List =[1,2,2,3,3,3,4,4,4,4,5,5,5,5,5]
Strlist=['A','B','B','C','C','C','D','D','D','D']
res = Counter(List)
print(res)
res=Counter(Strlist)
print(res)