Write a function reverseString(STR) in Python, that takes a string, STR as an argument and returns the string with its characters in reverse order. If the string is empty, return an empty string.

For example, Consider the following string

STR = "Hello World"

The output should be:

dlroW olleH

Answer:

Answer by student

Python function that takes a string an argument and returns the string with its characters in reverse order - Teachoo.png

Detailed answer by teachoo

The rest of the post is locked. Join Teachoo Black to see the full post.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.