소개 파이썬 목록 작업 (B) : 분류, 통계

작업 # 목록

. 1 num_list = [2 ,. 5 ,. 8 ,. 6 ,. 7 ,. 9 ,. 5 ,. 7 ]
 2  
. 3  # 오름차순 
. 4  num_list.sort ()
 . 5  전단 (num_list)
 . 6  
. 7  
. 8  # DESC 
. 9 num_list.sort (후진 = 참)
 10  인쇄 (num_list)
 . (11)  
(12)는  #의 반전 
13  num_list.reverse ()
 (14)  이 전단 (num_list)
 15  
16  # 적중 목록의 길이 
. 17 num_list_len = LEN (num_list)
 (18)는  인쇄 ( " 길이 D %의리스트 " %num_list_len)
 19 개  
20  # 통계 데이터가 동일한 수의 표시 
(21) num_count을 num_list.count = (5 )
 22  인쇄 ( " 5 % D 시간이있어왔다 " %의 num_count)
결과 :

추천

출처www.cnblogs.com/icebluelp/p/11615604.html