發布時間: 2018-01-08 10:26:54
arrays=[1,8,2,6,3,9,4]
for i in range(len(arrays)):
for j in range(i+1):
if arrays[j]>arrays[i]:
arrays[i],arrays[j]=arrays[j],arrays[i]
print(arrays)
運行結果輸出:
>>>
=============== RESTART: C:/Users/togogo/Desktop/day3/test3.py ===============
[1, 2, 3, 4, 6, 8, 9]
>>>
下一篇: {python} 九九乘法表