方法如链接所示: Python基础:用Python统计列表中每个单词出现的次数(split 的使用,for双重循环)_pyhoth统计列表中单词出现次数-CSDN博客f
list=[1,1,1,3,4,5]
def car_interview(nums: List[int],n:int):
dic={}
for num in nums:
if(num in dic.keys()):
dic[num]+=1
else:
dic[num]=1
new_dic=sorted(dic.items(),reverse=False)
print('new order {}'.format(new_dic))
return
car_interview(list,2)
python3 字典+1