Logo
Explore Help
Register Sign In
TheAlgorithms/Python
1
0
Fork 0
You've already forked Python
Code Issues Pull Requests Actions 2 Packages Projects Releases Wiki Activity
Files
5cfc017ebb51b7107c2c930df94ab18ef5e3c88c
Python/strings/remove_duplicate.py

15 lines
376 B
Python
Raw Normal View History

Refactor remove duplicates to more pythonic (#2093) * Refactor strings/remove_duplicate to more pythonic * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-11 06:13:40 +02:00
""" Created by sarathkaul on 14/11/19 """
Remove Duplicate Script Added (#1570) * Added Remove duplicate script and updated requirements.txt * Requirements.txt Updated * Remove Duplicate Script Added * Directory Modified * Directory.md Updated
2019-11-15 01:31:51 +05:30
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'
"""
Refactor remove duplicates to more pythonic (#2093) * Refactor strings/remove_duplicate to more pythonic * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-11 06:13:40 +02:00
return " ".join(sorted(set(sentence.split(" "))))
Remove Duplicate Script Added (#1570) * Added Remove duplicate script and updated requirements.txt * Requirements.txt Updated * Remove Duplicate Script Added * Directory Modified * Directory.md Updated
2019-11-15 01:31:51 +05:30
if __name__ == "__main__":
print(remove_duplicates("INPUT_SENTENCE"))
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 104ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API