Advertisement
Sayed_Tasif_97

Untitled

May 10th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. a = [40, 45, 33, 34, 8, 38, 28, 22, 1, 7, 49, 41, 14, 5, 22, 39, 15, 19, 36, 37, 43, 2, 5, 42, 46, 48, 49, 12, 48, 37,
  2.      8, 20, 30, 20, 4, 37, 27, 29, 7, 44, 15, 32, 35, 10, 28, 18, 2, 15, 36, 38]
  3. for item in a:
  4.     if item == item:
  5.         a.remove(item)
  6. print(a)
  7. OUTPUT :
  8. [45, 34, 38, 41, 22, 39, 19, 37, 5, 42, 12, 48, 37, 20, 20, 37, 29, 7, 44, 32, 10, 18, 2, 15, 38]
  9.  
  10.  
  11. a = [40, 45, 33, 34, 8, 38, 28, 22, 1, 7, 49, 41, 14, 5, 22, 39, 15, 19, 36, 37, 43, 2, 5, 42, 46, 48, 49, 12, 48, 37,
  12.      8, 20, 30, 20, 4, 37, 27, 29, 7, 44, 15, 32, 35, 10, 28, 18, 2, 15, 36, 38]
  13. asa = []
  14. for b in a:
  15.     if b not in asa:
  16.         asa.append(b)
  17. print(asa)
  18. OUTPUT:
  19. [40, 45, 33, 34, 8, 38, 28, 22, 1, 7, 49, 41, 14, 5, 39, 15, 19, 36, 37, 43, 2, 42, 46, 48, 12, 20, 30, 4, 27, 29, 44, 32, 35, 10, 18]
  20.  
  21. # Now my question is what is the difference between these 2 codes?????
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement