From 39c27a2c74344670745340edb7ee30ef3197da90 Mon Sep 17 00:00:00 2001 From: momstrosity Date: Thu, 22 May 2025 14:04:19 -0300 Subject: [PATCH 1/2] Start draft PR From 2351f671a64b6cc65df4b03f60f7c038c16e531e Mon Sep 17 00:00:00 2001 From: momstrosity Date: Thu, 22 May 2025 14:04:34 -0300 Subject: [PATCH 2/2] Add string reversal function with input validation --- src/string_utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/string_utils.py diff --git a/src/string_utils.py b/src/string_utils.py new file mode 100644 index 0000000..44bb6af --- /dev/null +++ b/src/string_utils.py @@ -0,0 +1,19 @@ +def reverse_string(input_string): + """ + Reverses the given input string. + + Args: + input_string (str): The string to be reversed. + + Returns: + str: The reversed string. + + Raises: + TypeError: If the input is not a string. + """ + # Check if input is a string + if not isinstance(input_string, str): + raise TypeError("Input must be a string") + + # Return the reversed string + return input_string[::-1] \ No newline at end of file