Skip to content

Commit 58efbb4

Browse files
authored
Updated exemplar and stub docstrigs to use Google style. (#4159)
1 parent e8b988b commit 58efbb4

2 files changed

Lines changed: 45 additions & 21 deletions

File tree

exercises/concept/little-sisters-essay/.meta/exemplar.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
def 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):
1417
def 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):
2430
def 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):
3544
def 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)

exercises/concept/little-sisters-essay/string_methods.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
def 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
pass
@@ -14,18 +17,24 @@ def capitalize_title(title):
1417
def 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 - return True if punctuated correctly with period, False otherwise.
20+
Parameters:
21+
sentence (str): A sentence to check.
22+
23+
Returns:
24+
bool: Is the sentence punctuated correctly?
1925
"""
2026

2127
pass
2228

2329

2430
def clean_up_spacing(sentence):
25-
"""Verify that there isn't any whitespace at the start and end of the sentence.
31+
"""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
pass
@@ -34,10 +43,13 @@ def clean_up_spacing(sentence):
3443
def replace_word_choice(sentence, old_word, new_word):
3544
"""Replace a word in the provided sentence with a new one.
3645
37-
:param sentence: str - a sentence to replace words in.
38-
:param old_word: str - word to replace.
39-
:param new_word: str - replacement word.
40-
:return: str - input sentence with new words in place of old words.
46+
Parameters:
47+
sentence (str): A sentence to replace words in.
48+
old_word (str): The word to replace.
49+
new_word (str): The replacement word.
50+
51+
Returns:
52+
str: Input sentence with new words in place of old words.
4153
"""
4254

4355
pass

0 commit comments

Comments
 (0)