# coding = utf-8 import random def Creat_Arr(): arr = [] for i in range(0,10) : arr.append(random.randint(1,100)) i += 1 print ('生成数组 : %s'%arr) return arr def Arr_Sort(arr): for i in range(len(arr)-1, 1, -1): for j in range(0, i): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] print ('排序后 : %s'%arr) if __name__ == '__main__': Arr_Sort(Creat_Arr())