python计数排序

n=[4,2,5,7,8,9,1,3]
x=[0]*(max(n)+1)
for i in n:
    x[i]=x[i]+1
for i in range(len(x)):
    if x[i]!=0:
        for j in range(x[i]):
            print(i,end=" ")