python example

Reverse a string in Python

Reverse characters with slicing. A one-liner you can try in the online Python compiler.

text[::-1] walks the string backwards. It is the usual playground version of reverse.

Print both the original and the reversed value so you can see the pair in Output.

def reverse_string(text):
    return text[::-1]

print(reverse_string("Code Arena"))