题解 | py3库函数排序
输入整型数组和排序标识,对其元素按照升序或降序进行排序
https://www.nowcoder.com/practice/dd0c6b26c9e541f5b935047ff4156309
n = int(input())
ls = list(map(int, input().split()))
rnk = int(input())
if rnk == 0:
ls.sort()
else:
ls.sort(reverse = True)
for i in ls:
print(i,end = ' ')
查看20道真题和解析