Skip to content

Commit ad4a9ab

Browse files
Update remove_duplicate.py
1 parent dba8eec commit ad4a9ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

strings/remove_duplicate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def remove_duplicates(sentence: str) -> str:
66
>>> remove_duplicates("Python is great and Java is also great")
77
'Java Python also and great is'
88
"""
9-
return " ".join(sorted(set(sentence.split())))
9+
return " ".join(list(OrderedDict.fromkeys(sentence.split())))
1010

1111

1212
if __name__ == "__main__":

0 commit comments

Comments
 (0)