PAT (Basic Level) Practice Python解法 1023 组个最小数(sort/sorted)
data = list(map(int,input().split(' ')))
sample = []
for index in range(1,len(data)):
if data[index] != 0:
sample.append(str(index))
data[index] = data[index]-1
break
for index in range(len(data)):
if data[index] != 0:
sample.append(str(index)*data[index])
print(''.join(sample))
放一个sort和sorted的使用链接,注意是否改变原始iteration。click me