Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 19th, 2018 52 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. def deduplicate(List):
  2.     s = set(List)
  3.     l = list(s)
  4.     return l
  5.  
  6. def deduplicate_1(List):
  7.     s = set()
  8.     for element in List:
  9.         s.add(element)
  10.     l = list(s)
  11.     return l
  12.  
  13. def deduplicate_2(List):
  14.     l = []
  15.     for element in List:
  16.         if element not in l:
  17.             l.append(element)
  18.     return l
  19.  
  20. values = [1, 3, 5, 7, 9, 7, 5, 3, 1]
  21. print(deduplicate(values))
  22. print(deduplicate_1(values))
  23. print(deduplicate_2(values))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top