导航

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

Posted on 2019-07-23 22:26  苏格拉底编程器  阅读(291)  评论(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))