devops-exercises/topics/python/solutions/reverse_string.md
abregman 99c4e02ecf Rename exercises dir
Name it instead "topics" so it won't be
strange if some topics included "exercises" directory.
2022-08-02 01:53:56 +03:00

17 lines
236 B
Markdown

## Reverse a String - Solution
```
my_string[::-1]
```
A more visual way is:<br>
<i>Careful: this is very slow</i>
```
def reverse_string(string):
temp = ""
for char in string:
temp = char + temp
return temp
```