From e43f3571daea0bc6b6971cd15d9337c2955aa517 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 08:57:41 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`add-uti?= =?UTF-8?q?ls`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @npthl2. * https://github.com/npthl2/coderabgit-dest/pull/1#issuecomment-2999432472 The following files were modified: * `simple_utils.py` --- simple_utils.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/simple_utils.py b/simple_utils.py index 614c847..d2c0740 100644 --- a/simple_utils.py +++ b/simple_utils.py @@ -1,13 +1,39 @@ # simple_utils.py - A tiny utility library def reverse_string(text): - """Reverses the characters in a string.""" + """ + Return a new string with the characters of the input string in reverse order. + + Parameters: + text (str): The string to be reversed. + + Returns: + str: The reversed string. + """ return text[::-1] def count_words(sentence): + """ + Count the number of words in a sentence by splitting on whitespace. + + Parameters: + sentence (str): The input string to analyze. + + Returns: + int: The number of words found in the sentence. + """ return len(sentence.split()) def celsius_to_fahrenheit(celsius): + """ + Convert a temperature from Celsius to Fahrenheit. + + Parameters: + celsius (float): Temperature value in degrees Celsius. + + Returns: + float: Equivalent temperature in degrees Fahrenheit. + """ return (celsius * 9/5) + 32