Fixed remove duplicate (#2470)

* fixed remove duplicate

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Du Yuanchao 2020-09-24 19:14:52 +08:00 committed by GitHub
parent 902fe1c907
commit 3a275caf01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()