#!/usr/bin/env python# @coding : utf-8# @File : sort01.py# @Time : 2017/11/1 18:30# @Author : Kilosnow# @Software: PyCharm Community Editionls = [12, 45, 456, 78, 121, 32, 56, 495, 78, 98, 90, 51, 22, 59, 789, 45]for i in range(0, len(ls) - 1): t = i for j in range(i + 1, len(ls)): if ls[j] < ls[t]: t = j ls[i], ls[t] = ls[t], ls[i]print(ls)
PS: 选择排序
PS:自用的 不做解释 作者:一个吃货帅锅