Advertisement
here2share

# unique_seq.py -- for python 2.x ^ 2017.09

Sep 20th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. # unique_seq.py -- for python 2.x
  2.  
  3. unique_seq = lambda u: sorted(set(u), key=lambda s: u.index(s))
  4.  
  5. print unique_seq([4, 2, 1, 0, 1, 3, 2])
  6. print unique_seq([3, 1, 4, 0, 1, 2, 4]) # double check
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement