From 79fbf5f41e83c1f70ab1af417c063c75c4fd0f3c Mon Sep 17 00:00:00 2001 From: koushithatadiboina Date: Tue, 25 Nov 2025 14:18:01 +0530 Subject: [PATCH] Create Python-reverse_string I added a new function named reverse_string inside the strings folder. It returns the reversed form of a given text using a simple loop without using any built-in reverse features. This small example helps beginners practice string operations in Python. --- Python-reverse_string | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Python-reverse_string diff --git a/Python-reverse_string b/Python-reverse_string new file mode 100644 index 000000000000..b148367918af --- /dev/null +++ b/Python-reverse_string @@ -0,0 +1,11 @@ +def reverse_string(text: str) -> str: + if not isinstance(text, str): + return "" + + result = "" + length = len(text) + + for i in range(length - 1, -1, -1): + result += text[i] + + return result