7-8 sdut-统计工龄

知识点:sorted函数(dict默认10比2小)

n=int(input())
num=[int(x) for x in input().split()]
mp={}
for i in num:
    mp.setdefault(i,0)
    mp[i]=mp[i]+1

for i,j in sorted(mp.items()):
    print("{}:{}".format(i,j))
posted @ 2022-05-30 10:48  kingwzun  阅读(45)  评论(0编辑  收藏  举报