29 lines
819 B
Markdown
29 lines
819 B
Markdown
## Reversed String
|
|
|
|
Write a function called ```revstring``` that takes a string as input and returns the reversed string.
|
|
|
|
### Function Signature:
|
|
```python
|
|
def revstring(x).
|
|
# return your solution
|
|
```
|
|
|
|
#### Requirements
|
|
- The function should return the input string reversed
|
|
- Your function will be tested with various cases, including:
|
|
- An empty string
|
|
- A single character
|
|
- A palindrome ("racecar")
|
|
- A string of numbers ("12345")
|
|
- Special characters
|
|
- A normal string ( "Hello World" )
|
|
|
|
#### Example:
|
|
```python
|
|
revstring("Hello World") # returns "dlroW olleH"
|
|
revstring("") # returns ""
|
|
revstring("racecar") # returns "racecar"
|
|
revstring("12345") # returns "54321"
|
|
revstring("!@# $%") # returns "%$ #@!"
|
|
```
|
|
You can copy this into your problems solution |