Back to Devops Exercises

Reverse String

topics/python/solutions/reverse_string.md

latest235 B
Original Source

Reverse a String - Solution

my_string[::-1]

A more visual way is:

<i>Careful: this is very slow</i>

def reverse_string(string):
    temp = ""
    for char in string:
        temp =  char + temp
    return temp