Reverse a String
Easy
76
48.9% Acceptance
Your task is to write a Python function named reverse_string
that reverses any given string. This function should be able to handle various types of inputs and return the reversed string as output.
Remember, you are not allowed to use any built-in string reversal functions in Python. The goal is to implement the logic for reversing a string manually.
Function Requirements
- The function should be named
reverse_string
. - It should take a single argument, which is the string to be reversed.
- The function should return the reversed string.
Examples
- Input:
reverse_string("hello")
Output:"olleh"
- Input:
reverse_string("codedamn")
Output:"nmadedoc"
Ensure your function works for strings containing numbers as well as letters.
Focus on implementing the function to handle different types of strings effectively. Good luck!