Add 57 new questions and exercises
This commit is contained in:
16
exercises/python/solutions/reverse_string.md
Normal file
16
exercises/python/solutions/reverse_string.md
Normal file
@ -0,0 +1,16 @@
|
||||
## 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
|
||||
```
|
Reference in New Issue
Block a user