Skip to content

Commit

Permalink
Added doctest to detecting_english_programmatically.py (TheAlgorithms…
Browse files Browse the repository at this point in the history
  • Loading branch information
Suyashd999 authored Nov 6, 2023
1 parent eb989c0 commit fa508d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions strings/detecting_english_programmatically.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ def get_english_count(message: str) -> float:


def remove_non_letters(message: str) -> str:
"""
>>> remove_non_letters("Hi! how are you?")
'Hi how are you'
>>> remove_non_letters("P^y%t)h@o*n")
'Python'
>>> remove_non_letters("1+1=2")
''
>>> remove_non_letters("www.google.com/")
'wwwgooglecom'
>>> remove_non_letters("")
''
"""
return "".join(symbol for symbol in message if symbol in LETTERS_AND_SPACE)


Expand Down

0 comments on commit fa508d7

Please sign in to comment.