mirror of
https://github.com/bregman-arie/devops-exercises.git
synced 2026-02-05 16:19:10 +00:00
17 lines
236 B
Markdown
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
|
|
```
|