ShriRam Changed status to publish August 18, 2023
my_list=[10,20,30,40,20,50,60,40]
print(“Original List : “,my_list)
my_set=set(my_list)
my_new_list=list(my_set)
print(“List of unique numbers : “,my_new_list)
OR
numbers=[1,2,3,4,1,2,3,4]
dup_items = set()
uniq_items = []
for x in numbers:
if x not in dup_items:
uniq_items.append(x)
dup_items.add(x)
uniq_items.sort()
print (uniq_items)
ShriRam Changed status to publish August 18, 2023