首页 > 其他 > 详细

删除list 中重复的名字,并统计总人数

时间:2019-07-23 23:20:55      阅读:143      评论:0      收藏:0      [点我收藏+]
###Task###: 
1)Find out the duplicated value in the list;
2)Remove all the duplicated value;
3)Output the sorting list in ascending order;
4)Output the total count number from sorted list.

###Solution###:
numbers = [4, 6, 1, 23, 12, 6, 12, 4, 6, 23, 12, 8, 9]
uniques = []
for number in numbers:
if number not in uniques:
uniques.append(number)
uniques.sort()
print(uniques)
print(len(uniques))

删除list 中重复的名字,并统计总人数

原文:https://www.cnblogs.com/Dennis-HM/p/11234917.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!