题解 | #输入整型数组和排序标识,对其元素按照升序或降序进行排序#
输入整型数组和排序标识,对其元素按照升序或降序进行排序
http://www.nowcoder.com/practice/dd0c6b26c9e541f5b935047ff4156309
##法一 nn = input() listt = input() mode = input() str_list = listt.split(" ") n_list = [int(i) for i in str_list] if mode == "0": n_list.sort() elif mode == "1": n_list.sort(reverse=True) else: print("error") out_str = "" for i in n_list:
out_str += str(i)
out_str += " "
print(out_str.strip())