def select_sort(slist): for i in range(len(slist)): x = i for j in range(i, len(slist)): if slist[j] < slist[x]: x = j slist[i], slist[x] = slist[x], slist[i] return slist slist = select_sort([4,5,6,7,3,2,6,9,8])print(slist)
本文共 334 字,大约阅读时间需要 1 分钟。
def select_sort(slist): for i in range(len(slist)): x = i for j in range(i, len(slist)): if slist[j] < slist[x]: x = j slist[i], slist[x] = slist[x], slist[i] return slist slist = select_sort([4,5,6,7,3,2,6,9,8])print(slist)
转载于:https://www.cnblogs.com/sea-stream/p/9689052.html