Exercise: String Reversal
Leer en Español | Solve Online
Background/Motivation
Reversing a string is a common operation that can be accomplished in various ways, such as using loops or Python's built-in slicing capabilities. This exercise helps in understanding string manipulation and immutability.
The Task
Implement a function string_reversal(s: str) -> str that reverses a given string.
Specifications
- Function Name:
string_reversal - Arguments:
s(str) - Return Type:
str - Expected Output: The reversed string.
Constraints
- The input string can be empty or contain any characters.
Example
Instructions
- Open
exercises/string_reversal/solution.py. - Implement the
string_reversalfunction. - Change
SUBMIT = FalsetoSUBMIT = Trueat the top of the file when you are ready to be graded. - Run
python solution.pylocally to verify your solution with the built-in self-tests.