Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = [1,2,3,2,1,5,6,5,5,5]
- seen = set()
- uniq = [x for x in a if x not in seen and not seen.add(x)]
- print(uniq)
- >> [1,2,3,4,5]
- print(seen)
- >> {1,2,3,4,5}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement