Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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,
- 8, 20, 30, 20, 4, 37, 27, 29, 7, 44, 15, 32, 35, 10, 28, 18, 2, 15, 36, 38]
- for item in a:
- if item == item:
- a.remove(item)
- print(a)
- OUTPUT :
- [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]
- 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,
- 8, 20, 30, 20, 4, 37, 27, 29, 7, 44, 15, 32, 35, 10, 28, 18, 2, 15, 36, 38]
- asa = []
- for b in a:
- if b not in asa:
- asa.append(b)
- print(asa)
- OUTPUT:
- [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]
- # Now my question is what is the difference between these 2 codes?????
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement