hard
Explain a Bug and Fix
Analyze a code snippet, identify the bug, and explain the solution.
📝 Prompt Content
Review the following Python function intended to reverse a string. It is not returning the expected output. Identify the logic error, explain why it is happening, and provide the corrected code.