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 python unit test?
Should I use single or double quotes in python?
Do sheeps sleep?
Does python have polymorphism?
Explain the use of the ‘nonlocal’ keyword in python?
What is python used for at google?
What is none python?
How is Multithreading achieved in Python?
What are the tools that help to find bugs or perform the static analysis?
What are the differences between the threading and multiprocessing in python?
Explain the difference between append vs extend in list?
Explain how can you access a module written in python from c?