Python Practice › List Programs › Program 76
Remove duplicate strings
Write a Python program to remove duplicate strings from a list.
Input
["python", "is", "a", "best", "language", "python", "best"]
Output
['python', 'is', 'a', 'best', 'language']
Approach
dict.fromkeys.
Solution
words = ["python", "is", "a", "best", "language", "python", "best"]print(list(dict.fromkeys(words)))Output
['python', 'is', 'a', 'best', 'language']
Learn the concept
New to this topic? Read the lesson, then come back.