Answer to Question #274794 in Python for Naveen

Question #274794

pop()




a=[10, 20,30,40,50,30]




a. remove(30)

1
Expert's answer
2021-12-02T17:25:46-0500
# If you need list without duplicate elements, code below
l = [10,20,30,40,50,30, 50]
print(list(set(l)))


# If you need duplicate from list, code below
seen = {}
dupes = []
for x in l:
    if x not in seen:
        seen[x] = 1
    else:
        if seen[x] == 1:
            dupes.append(x)
print(dupes)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS