选择排序

来源:互联网 发布:北京大数据培训班 编辑:程序博客网 时间:2024/06/05 18:22
#!/usr/bin/env python3# -*- coding: utf-8 -*-' a test module '__author__ = 'Zhang Shuai's = [2, 4, 45, 23, 65, 234, 3, 123, 455, 26, 87, 96, 34]def xuanze(L):    for i in range(len(L)):        index = i        for j in range(i + 1, len(L)):            if L[index] > L[j]:                index = j        L[i], L[index] = L[index], L[i]xuanze(s)print(s)
原创粉丝点击