Reverse a String

Reverse a String

Tags: String Manipulation Basics

Credit: CodingChallenge

Difficulty: Beginner

Type: Text

Category: Practice

Time Allowed: 5 s

Description:

Write a function that takes a string and returns the string reversed. This problem is designed to help you practice string manipulation and slicing. The function should accept one parameter and return the reversed string.

Constraints:

  • The input will be a string.
  • The function should return a string that is the reverse of the input.

Example:

  • Input: "hello"
  • Output: "olleh"

Test Case Input Expected Output
1 "hello" "olleh"
2 "world" "dlrow"
3 "Python" "nohtyP"
4 "racecar" "racecar"
5 "12345" "54321"
6 "!@#$%" "%$#@!"
7 "" ""

Please register or login to submit solutions to challenges.