Last active
November 7, 2021 11:15
-
-
Save AliBahaari/e5929a4ec7b4d37eb38f670b2a1b2dda to your computer and use it in GitHub Desktop.
How to remove duplicates from a list?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| duplicatesList = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1] | |
| cleanedList = list(set(duplicatesList)) | |
| print(cleanedList) | |
| # Output: [1, 2, 3, 4, 5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment