strings.largest_smallest_words¶
Attributes¶
Functions¶
|
Find the smallest and largest words in a given input string based on their length. |
Module Contents¶
- strings.largest_smallest_words.find_smallest_and_largest_words(input_string: str) tuple¶
Find the smallest and largest words in a given input string based on their length.
- Args:
input_string (str): The input string to analyze.
- Returns:
tuple: A tuple containing the smallest and largest words found. If no words are found, both values in the tuple will be None.
Examples: >>> find_smallest_and_largest_words(“My name is abc”) (‘My’, ‘name’)
>>> find_smallest_and_largest_words("Hello guys") ('guys', 'Hello')
>>> find_smallest_and_largest_words("OnlyOneWord") ('OnlyOneWord', 'OnlyOneWord')
- strings.largest_smallest_words.input_string¶