0 out of 68 challenges solved

Reverse characters in a string

Question:
Write a function called reverse_string that takes a string as input and returns a new string with the characters reversed. Use a while loop to iterate through each character in the string and perform the reversal.

Example:
Input: "Hello, World!"
Output: "!dlroW ,olleH"

def reverse_string(string):
    """
    Reverses the characters in the given string.

    Args:
    string (str): The input string.

    Returns:
    str: A new string with the characters reversed.
    """
    # TODO: Implement the reverse_string function
    pass