From 82639e1db41ef3e233af53879b26bfc2feb9e7a4 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 04:54:14 +0000 Subject: [PATCH 1/2] [Sync Iteration] python/little-sisters-essay/1 --- .../little-sisters-essay/1/string_methods.py | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 solutions/python/little-sisters-essay/1/string_methods.py diff --git a/solutions/python/little-sisters-essay/1/string_methods.py b/solutions/python/little-sisters-essay/1/string_methods.py new file mode 100644 index 0000000..1456ef0 --- /dev/null +++ b/solutions/python/little-sisters-essay/1/string_methods.py @@ -0,0 +1,47 @@ +"""Functions to help edit essay homework using string manipulation.""" + + +def capitalize_title(title: str) -> str: + """ + Convert the first letter of each word in the title to uppercase if needed. + + :param title: str - title string that needs title casing. + :return: str - title string in title case (first letters capitalized). + """ + + return title.title() + + +def check_sentence_ending(sentence: str) -> bool: + """ + Check the ending of the sentence to verify that a period is present. + + :param sentence: str - a sentence to check. + :return: bool - return True if punctuated correctly with period, False otherwise. + """ + + return True if sentence[-1] in ".!?" else False + + +def clean_up_spacing(sentence: str) -> str: + """ + Verify that there isn't any whitespace at the start and end of the sentence. + + :param sentence: str - a sentence to clean of leading and trailing space characters. + :return: str - a sentence that has been cleaned of leading and trailing space characters. + """ + + return sentence.strip() + + +def replace_word_choice(sentence: str, old_word: str, new_word: str) -> str: + """ + Replace a word in the provided sentence with a new one. + + :param sentence: str - a sentence to replace words in. + :param old_word: str - word to replace. + :param new_word: str - replacement word. + :return: str - input sentence with new words in place of old words. + """ + + return sentence.replace(old_word, new_word) From f855534cd5615115e2ac09832527fd30cdb56188 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Wed, 24 Sep 2025 22:00:39 -0700 Subject: [PATCH 2/2] Update string_methods.py --- little-sisters-essay/string_methods.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/little-sisters-essay/string_methods.py b/little-sisters-essay/string_methods.py index df6dc79..bb1678a 100644 --- a/little-sisters-essay/string_methods.py +++ b/little-sisters-essay/string_methods.py @@ -38,9 +38,7 @@ def clean_up_spacing(sentence: str) -> str: return sentence.strip() -def replace_word_choice(sentence: str, - old_word: str, - new_word: str) -> str: +def replace_word_choice(sentence: str, old_word: str, new_word: str) -> str: """ Replace a word in the provided sentence with a new one.