Published on January 26, 2024By DeveloperBreeze

# Define a list with duplicates
my_list = [10, 20, 30, 20, 40, 10, 50]

# Create a new list with unique elements using set
unique_list = list(set(my_list))

Comments

Please log in to leave a comment.

Continue Reading:

Remove Duplicates from Array Using Set

Published on January 26, 2024

javascript

Sort a List

Published on January 26, 2024

python

Calculate Average of Numbers

Published on January 26, 2024

python

Enumerating List Elements

Published on January 26, 2024

python

Find Maximum Value in a List

Published on January 26, 2024

python

JavaScript Remove Duplicates from an Array

Published on January 26, 2024

javascript

Java: How to Sort a List

Published on August 12, 2024

java