fork download
  1. from functools import reduce
  2.  
  3. def unique(list_):
  4. return reduce(lambda l, x: l if x in l else l+[x], list_, [])
  5.  
  6. print(unique([1, 1, 3, 1, 3, 2, 8, 7]))
Success #stdin #stdout 0.01s 10320KB
stdin
Standard input is empty
stdout
[1, 3, 2, 8, 7]