Skip to content

Commit

Permalink
Fixed remove duplicate (TheAlgorithms#2470)
Browse files Browse the repository at this point in the history
* fixed remove duplicate

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
  • Loading branch information
2 people authored and stokhos committed Jan 3, 2021
1 parent 77d386c commit a6ee520
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions strings/remove_duplicate.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
""" Created by sarathkaul on 14/11/19 """


def remove_duplicates(sentence: str) -> str:
"""
Reomove duplicates from sentence
Remove duplicates from sentence
>>> remove_duplicates("Python is great and Java is also great")
'Java Python also and great is'
>>> remove_duplicates("Python is great and Java is also great")
'Java Python also and great is'
"""
return " ".join(sorted(set(sentence.split(" "))))
return " ".join(sorted(set(sentence.split())))


if __name__ == "__main__":
print(remove_duplicates("INPUT_SENTENCE"))
import doctest

doctest.testmod()

0 comments on commit a6ee520

Please sign in to comment.