Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 258 Bytes

reverse_string.md

File metadata and controls

20 lines (15 loc) · 258 Bytes

Reverse String

  1. Reverse a string

Solution

my_string[::-1]

A more visual way is:
Careful: this is very slow

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