Write a program that defines a function to return a new list by eliminating the duplicate values in the list in python
Code
def remove_duplicates(l):return list(set(l))if __name__ == "__main__":l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]print(remove_duplicates(l))
Output
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
0 Comments
Post a Comment