Functions · 20 / 27 Exercise Medium

Function to show an inverted string

Objective

Create a Python program with a function called reverse_string that receives a text and returns it in reverse order.

Instructions

  • In the main function, ask the user for a text.
  • Implement the function reverse_string with the text as a parameter.
  • Call the function with the text entered by the user and display the reversed text.
Input
hello
Output
olleh

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise