輸入任意整數,請把這這些數由小到大輸出
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