mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 05:21:09 +00:00
3de6f010c3
* Refactor strings/remove_duplicate to more pythonic * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
15 lines
376 B
Python
15 lines
376 B
Python
""" Created by sarathkaul on 14/11/19 """
|
|
|
|
|
|
def remove_duplicates(sentence: str) -> str:
|
|
"""
|
|
Reomove duplicates from sentence
|
|
>>> remove_duplicates("Python is great and Java is also great")
|
|
'Java Python also and great is'
|
|
"""
|
|
return " ".join(sorted(set(sentence.split(" "))))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(remove_duplicates("INPUT_SENTENCE"))
|