십시오 : 파이썬은 연습, 네 가지 방법의 목록을 정렬

이 TTT의 주, 산들 바람 전환 주소 : HTTPS : //www.cnblogs.com/tttzqf/p/9270509.html

 

DEF sort_list_method_1 (a) :
    복귀 (a) 정렬


(sort_list_method_1 ([1, 4,2])) 인쇄


: DEF sort_list_method_2 (a)
    의 범위의 난에 대한 LEN ((a)) :
        m = 1
        내지 Z (i에 +1, 렌 (a)) :
            A [m]를> A [(Z)]가있는 경우 :
                m = Z
        A [m], A [I] = A [i]를, A [m]를
    반환하며


(sort_list_method_2을 인쇄 ([2- 4, 1]))


DEF sort_list_method_3 (a)
    B = []
    전 범위 (렌에 대해 (a)) :
        b.append (분 (a))
        a.remove (분 (a))
    리턴 B의


인쇄 ( sort_list_method_3 ([4,2, -2, 8))


DEF sort_list_method_4 (a)
        리턴 a.sort ()


B = [4, 3, 7, -2, 1]
sort_list_method_4 (b)
인쇄 (b)

추천

출처www.cnblogs.com/cbma0116/p/11881159.html