Python之排序

##冒泡排序

1
2
3
4
5
6
7
8
a=list(map(int,input().split()))
for round in range(len(a)-1):
for j in range(round+1,len(a)):
if a[round]<a[j]:
a[round],a[j]=a[j],a[round]
print(a)
##input:1 2 7 5 6 4 2 3 10 8
##output:[10,8,7,6,5,4,3,2,2,1]