8000 Fixed remove duplicate (#2470) · Algorithm-box/Python@3a275ca · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Lines changed: 7 additions & 6 deletions
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)
0