Write a program to find the duplicates in a list?
Answer / Amit Kumar Giri
Here's a Python program that finds duplicates in a list:nn```pythonnlst = [1, 2, 3, 4, 4, 5, 6, 7, 8, 8]ndups = set(lst) # convert list to set to remove duplicatesndups -= set(lst) # find the difference between the original set and the converted set. This gives us the duplicates.nprint(list(dups))```
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the accomplishment you are most proud of?
How much ram is required for python?
Is python better than matlab?
What is python’s standard way of identifying a block of code?
Why is the order in python dictionaries and sets arbitrary?
Explain the difference between append vs extend in list?
What are metaclasses in python?
Where can I learn python for free?
Can you name ten built-in functions in python and explain each in brief?
We know python is all the rage these days. But to be truly accepting of a great technology, you must know its pitfalls as well. Would you like to talk about this?
Can you list down some of the pdb commands for debugging python programs?
What companies use python?