Use list slicing with a negative step:
string = "This is a test" reverse = string[::-1] print(reverse)
When run, this prints:
tset a si sihT
This syntax works for lists and other enumerables, too:
>>> print([1,2,3][::-1]) [3, 2, 1]