a = [1, 3, 7, 1, 6, 8, 2, 4, 7, 3, 5, 6, 2]s = set()print([s.add(x) or x for x in a if x not in s])
Standard input is empty
[1, 3, 7, 6, 8, 2, 4, 5]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!