diff --git a/exercises/concept/little-sisters-vocab/.meta/exemplar.py b/exercises/concept/little-sisters-vocab/.meta/exemplar.py index c71d4902cae..c17350fd3a7 100644 --- a/exercises/concept/little-sisters-vocab/.meta/exemplar.py +++ b/exercises/concept/little-sisters-vocab/.meta/exemplar.py @@ -4,26 +4,34 @@ def add_prefix_un(word): """Take the given word and add the 'un' prefix. - :param word: str - containing the root word. - :return: str - of root word prepended with 'un'. + Parameters: + word (str): The root word. + + Returns: + str: Root word prepended with 'un'. """ return 'un' + word def make_word_groups(vocab_words): - """Transform a list containing a prefix and words into a string with the prefix followed by the words with prefix prepended. + """Transform a list containing a prefix and words. + + Parameters: + vocab_words (list[str]): Vocabulary words with prefix at first index. - :param vocab_words: list - of vocabulary words with prefix in first index. - :return: str - of prefix followed by vocabulary words with + Returns: + str: Prefix followed by vocabulary words with prefix applied. - This function takes a `vocab_words` list and returns a string + This function takes a `vocab_words` list of strings and returns a string with the prefix and the words with prefix applied, separated by ' :: '. - For example: list('en', 'close', 'joy', 'lighten'), - produces the following string: 'en :: enclose :: enjoy :: enlighten'. + Examples: + >>> list('en', 'close', 'joy', 'lighten') + 'en :: enclose :: enjoy :: enlighten'. + """ prefix = vocab_words[0] @@ -35,10 +43,19 @@ def make_word_groups(vocab_words): def remove_suffix_ness(word): """Remove the suffix from the word while keeping spelling in mind. - :param word: str - of word to remove suffix from. - :return: str - of word with suffix removed & spelling adjusted. + Parameters: + word (str): Word to remove suffix from. + + Returns: + str: Word with suffix removed & spelling adjusted. + + Examples: + >>> remove_suffix_ness('heaviness') + 'heavy' + + >>> remove_suffix_ness('sadness') + 'sad' - For example: "heaviness" becomes "heavy", but "sadness" becomes "sad". """ word = word[:-4] @@ -51,11 +68,20 @@ def remove_suffix_ness(word): def adjective_to_verb(sentence, index): """Change the adjective within the sentence to a verb. - :param sentence: str - that uses the word in sentence. - :param index: int - index of the word to remove and transform. - :return: str - word that changes the extracted adjective to a verb. + Parameters: + sentence (str): The word used in a sentence as an adjective. + index (int): Index of the adjective to remove and transform. + + Returns: + str: The extracted adjective in verb form. + + Examples: + >>> adjective_to_verb('It got dark as the sun set.', 2) + 'darken' + + >>> adjective_to_verb('The ink stains her fingers black.', -1) + 'blacken' - For example, ("It got dark as the sun set", 2) becomes "darken". """ word = sentence.split()[index] diff --git a/exercises/concept/little-sisters-vocab/strings.py b/exercises/concept/little-sisters-vocab/strings.py index 39ae7bb80c8..e7c1a8de88a 100644 --- a/exercises/concept/little-sisters-vocab/strings.py +++ b/exercises/concept/little-sisters-vocab/strings.py @@ -4,26 +4,34 @@ def add_prefix_un(word): """Take the given word and add the 'un' prefix. - :param word: str - containing the root word. - :return: str - of root word prepended with 'un'. + Parameters: + word (str): The root word. + + Returns: + str: Root word prepended with 'un'. """ pass def make_word_groups(vocab_words): - """Transform a list containing a prefix and words into a string with the prefix followed by the words with prefix prepended. + """Transform a list containing a prefix and words. + + Parameters: + vocab_words (list[str]): Vocabulary words with prefix at first index. - :param vocab_words: list - of vocabulary words with prefix in first index. - :return: str - of prefix followed by vocabulary words with + Returns: + str: Prefix followed by vocabulary words with prefix applied. - This function takes a `vocab_words` list and returns a string + This function takes a `vocab_words` list of strings and returns a string with the prefix and the words with prefix applied, separated by ' :: '. - For example: list('en', 'close', 'joy', 'lighten'), - produces the following string: 'en :: enclose :: enjoy :: enlighten'. + Examples: + >>> list('en', 'close', 'joy', 'lighten') + 'en :: enclose :: enjoy :: enlighten'. + """ pass @@ -32,10 +40,19 @@ def make_word_groups(vocab_words): def remove_suffix_ness(word): """Remove the suffix from the word while keeping spelling in mind. - :param word: str - of word to remove suffix from. - :return: str - of word with suffix removed & spelling adjusted. + Parameters: + word (str): Word to remove suffix from. + + Returns: + str: Word with suffix removed & spelling adjusted. + + Examples: + >>> remove_suffix_ness('heaviness') + 'heavy' + + >>> remove_suffix_ness('sadness') + 'sad' - For example: "heaviness" becomes "heavy", but "sadness" becomes "sad". """ pass @@ -44,11 +61,20 @@ def remove_suffix_ness(word): def adjective_to_verb(sentence, index): """Change the adjective within the sentence to a verb. - :param sentence: str - that uses the word in sentence. - :param index: int - index of the word to remove and transform. - :return: str - word that changes the extracted adjective to a verb. + Parameters: + sentence (str): The word used in a sentence as an adjective. + index (int): Index of the adjective to remove and transform. + + Returns: + str: The extracted adjective in verb form. + + Examples: + >>> adjective_to_verb('It got dark as the sun set.', 2) + 'darken' + + >>> adjective_to_verb('The ink stains her fingers black.', -1) + 'blacken' - For example, ("It got dark as the sun set.", 2) becomes "darken". """ pass