Skip to content

Commit 3a275ca

Browse files
realDuYuanChaogithub-actions
and
github-actions
authored
Fixed remove duplicate (TheAlgorithms#2470)
* fixed remove duplicate * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent 902fe1c commit 3a275ca

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

strings/remove_duplicate.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
""" Created by sarathkaul on 14/11/19 """
2-
3-
41
def remove_duplicates(sentence: str) -> str:
52
"""
6-
Reomove duplicates from sentence
3+
Remove duplicates from sentence
74
>>> remove_duplicates("Python is great and Java is also great")
85
'Java Python also and great is'
6+
>>> remove_duplicates("Python is great and Java is also great")
7+
'Java Python also and great is'
98
"""
10-
return " ".join(sorted(set(sentence.split(" "))))
9+
return " ".join(sorted(set(sentence.split())))
1110

1211

1312
if __name__ == "__main__":
14-
print(remove_duplicates("INPUT_SENTENCE"))
13+
import doctest
14+
15+
doctest.testmod()

0 commit comments

Comments
 (0)