Python编程:排序输出

mac2022-06-30  94

输入任意整数,请把这这些数由小到大输出

1 arr=[] 2 for a in range(4): 3 a=int(input('请输入a:')) 4 arr.append(a) 5 arr.sort() 6 print(arr) View Code

结果:

请输入a:12 请输入a:45 请输入a:8 请输入a:6 [6, 8, 12, 45]

  

转载于:https://www.cnblogs.com/PPhoebe/p/6708861.html

相关资源:python对数组进行排序,并输出排序后对应的索引值方式
最新回复(0)