公司:#廣聯(lián)達 #小紅書
崗位:#自動化測試工程師
關(guān)鍵字: #Python腳本#冒泡排序 #coding=utf-8 def bubble_sort(array): for i in range(1, len(array)): for j in range(0, len(array)-i): if array[j] > array[j+1]: array[j], array[j+1] = array[j+1], array[j] return array if name == 'main': array = [10, 17, 50, 7, 30, 24, 27, 45, 15, 5, 36, 21] print(bubble_sort(array))