44def capitalize_title (title ):
55 """Convert the first letter of each word in the title to uppercase if needed.
66
7- :param title: str - title string that needs title casing.
8- :return: str - title string in title case (first letters capitalized).
7+ Parameters:
8+ title (str): Essay title that needs title casing.
9+
10+ Returns:
11+ str: The title string in title case (first letters capitalized).
912 """
1013
1114 return title .title ()
@@ -14,8 +17,11 @@ def capitalize_title(title):
1417def check_sentence_ending (sentence ):
1518 """Check the ending of the sentence to verify that a period is present.
1619
17- :param sentence: str - a sentence to check.
18- :return: bool - is the sentence punctuated correctly?
20+ Parameters:
21+ sentence (str): A sentence to check.
22+
23+ Returns:
24+ bool: Is the sentence punctuated correctly?
1925 """
2026
2127 return sentence .endswith ("." )
@@ -24,8 +30,11 @@ def check_sentence_ending(sentence):
2430def clean_up_spacing (sentence ):
2531 """Trim any leading or trailing whitespace from the sentence.
2632
27- :param sentence: str - a sentence to clean of leading and trailing space characters.
28- :return: str - a sentence that has been cleaned of leading and trailing space characters.
33+ Parameters:
34+ sentence (str): A sentence to clean of leading and trailing space characters.
35+
36+ Returns:
37+ str: A sentence that has been cleaned of leading and trailing space characters.
2938 """
3039
3140 clean_sentence = sentence .strip ()
@@ -35,10 +44,13 @@ def clean_up_spacing(sentence):
3544def replace_word_choice (sentence , old_word , new_word ):
3645 """Replace a word in the provided sentence with a new one.
3746
38- :param sentence: str - a sentence to replace words in.
39- :param old_word: str - word to replace.
40- :param new_word: str - replacement word.
41- :return: str - input sentence with new words in place of old words.
47+ Parameters:
48+ sentence (str): A sentence to replace words in.
49+ old_word (str): The word to replace.
50+ new_word (str): The replacement word.
51+
52+ Returns:
53+ str: Input sentence with new words in place of old words.
4254 """
4355
4456 better_sentence = sentence .replace (old_word , new_word )
0 commit comments