Q. Write a program to read a list of elements. Modify this list so that it does not contain any duplicate elements, i.e., all elements occurring multiple times in the list should appear only once.



Answer :-


lst = eval(input("Enter a list :-"))

for i in range(len(lst)) :
    for j in lst :
        if lst.count(j) > 1 :
            lst.remove(j)

print("New List :-",lst)

4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post