How to use a reverse function in python3?

I want to reverse a string without slicing it but only using reverse function. So how can I use reverse function to reverse a string?

Your Answer

You cannot use reverse() or reversed() function to reverse the string directly ,but can can reverse the string using reversed() and join() ,here is an example.

>>> st='Text!' #text to be reversed
>>> s=''
>>> s.join( reversed(st) )
'!txeT'

The 'text!' is reversed.

Python

Didn't get the answer.
Contact people of Talent-Python directly by clicking here