输入一个列表,去掉列表中重复的数字,按原来次序输出!
输入格式:
在一行中输入列表
输出格式:
在一行中输出不重复列表元素
输入样例:
在这里给出一组输入。例如:
[4,7,5,6,8,6,9,5]
输出样例:
在这里给出相应的输出。例如:
4 7 5 6 8 9
【Python参考代码】
版本一
#By yangbo 2020.8.07
lst = eval(input())# type(lst) 是列表
tup = set()#
st =[]#要输出的列表
for i in lst:
if i not in tup:
tup.add(i)
st.append(i)
print(" ".join(map(str,st)))
版本二
#By yangbo 2020.8.07
lst = eval(input())# type(lst) 是列表
st = list(set(lst))
print(" ".join(map(str,sorted(st,key=lst.index))))