Subscribe Us

Header Ads

How to Remove Duplicate items of list in python | interview Programs

 Hey guys in this video i am gonna tell you how you can remove duplicate items in list in python ..




Source code...

#creating a list with duplicate items

list1 = [20, 26, 20, 24, 25, 24, 45, 45, 20, 30, 32, 30, 31]

#printing list with duplicate items
print(f'oringal list = {list1}')

#first converting in set then in list 
list1 = list(set(list1))

#printing list wihout duplicate items
print(f' new list = { list1}')


Post a Comment

0 Comments