/
githubmirror
/
Python
Обзор
Документация
Войти
/
githubmirror
/
Python
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
strings/remove_duplicate.py
15 строк
434 B
Du Yuanchao
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>
24 сен 2020, 14:14
3a275ca
О чём код?
def remove_duplicates(sentence: str) -> str: """ 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()))) if __name__ == "__main__": import doctest doctest.testmod()