How do you remove duplicates from a list whilst preserving order?



How do you remove duplicates from a list whilst preserving order?..

Answer / Yashveer Singh

In Python, you can use the built-in set() function to remove duplicates while preserving order: `my_list = list(set(my_list))`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

How to tic tac toe computer move?

1 Answers  


Does python perform tail recursion optimization?

1 Answers  


What happens when you execute the statement mango=banana in python?

1 Answers  


Why does the following behave unexpectedly in python?

1 Answers  


What are the built-in type does python provides?

1 Answers  


What is the difference between raw_input() and input() in python?

1 Answers  


Explain split(), sub(), sub() methods of “re” module in python?

1 Answers  


What is __ getitem __?

1 Answers  


How can the ternary operators be used in python?

1 Answers  


What is the difference between range & xrange? Explain?

1 Answers  


What's the difference between list and tuples?

1 Answers  


Explain a few methods to implement functionally oriented programming in python?

1 Answers  


Categories