Run

Reverse a string in Python

Use slicing with a step of -1. Press Run to try it, then change the code and run it again.

main.py

text = "CodingHumans"
print(text[::-1])  # snamuHgnidoC
Output

Press Run to see the output.

More Python examples

Open the full Python online compiler →