'''用i遍历list,如果不在新列表中,则添加到新列表,,否则不添加进去,依次循环'''
list_2 = [10, 1, 2, 20, 10, 3, 2, 1, 15, 20, 44, 56, 3...i不在mylist_2,则添加到mylist_2
if i not in mylist_2:
mylist_2.append(i)
return...2, 1]
def func3(list_3):
"""
使用排序的方法
"""
result_list=[]
temp_list=sorted(list_3)
i=0
while...i<len(temp_list):
#如果不在result_list则添加进去,否则i+1
if temp_list[i] not in result_list:
result_list.append..."""
#fromkeys() 函数创建一个新字典,获取新字典的键(键值是唯一的)
result_list = []
for i in {}.fromkeys(list