题解 | #元素按照升序或降序进行排序#
输入整型数组和排序标识,对其元素按照升序或降序进行排序
https://www.nowcoder.com/practice/dd0c6b26c9e541f5b935047ff4156309
def sort(): num = int(input()) array = list(map(int,input().split())) order = int(input()) lst = sorted(array) if order == 0: sorted_array = sorted(array) else: sorted_array = sorted(array,reverse=True) output = ' '.join(map(str,sorted_array)) print(output) sort()