Advertisement
here2share

# remdups_noloop.py

Feb 6th, 2015
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. # remdups_noloop.py
  2. # Eliminating duplicate elements without looping
  3.  
  4. a = [1,2,1,4,5,2]
  5. b = list(set(a))    # [1,2,4,5]
  6. print b
  7.  
  8. a = '123abc123'
  9. b = ''.join(list(set(a)))    # 123abc
  10. print b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement