Python Program to Remove Duplicate Elements From a List Using set()
# Remove Duplicate Element From a List Using set() in Python
# initializing list
test_list = [1, 5, 3, 6, 3, 5, 6, 1, 7, 5, 3, 4]
print ("The original list is : "
+ str(test_list))
# using set() to remove duplicates from list
test_list = list(set(test_list))
# printing list after removal
# distorted ordering
print ("The list after removing duplicates : "
+ str(test_list))
Output:
The original list is : [1, 5, 3, 6, 3, 5, 6, 1, 7, 5, 3, 4]
The list after removing duplicates : [1, 3, 4, 5, 6, 7]
About The Author
Shailendra Bramhvanshi, Founder at Techaroha Solutions Private Limited and CEO at Newtum Solutions Private Limited. BlockChain Experts with 12 years of IT Experience in of all aspects of running Organization and Project Management. I have created different coins to help the business to bring more trust. Recently deployed a stable coin in India TrueINR and working on few cryptocurrency exchanges. My Team is being rated as a top 10 blockchain service provider in India by Silicon India