fuck you all
This commit is contained in:
29
problems/reversedstring/description.md
Normal file
29
problems/reversedstring/description.md
Normal file
@@ -0,0 +1,29 @@
|
||||
## 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
|
||||
6
problems/reversedstring/manifest.json
Normal file
6
problems/reversedstring/manifest.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"title":"Reversed String",
|
||||
"description":"Reverse a String using a Function ; Try to write as little code as possible",
|
||||
"description_md":"problems/reversedstring/description.md",
|
||||
"test_code":"problems/reversedstring/test.py"
|
||||
}
|
||||
19
problems/reversedstring/test.py
Normal file
19
problems/reversedstring/test.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import unittest
|
||||
|
||||
#<!-- The Function the User needs to write -->
|
||||
def revstring(x):
|
||||
return x[::-1]
|
||||
|
||||
#<!-- This Test, test if the function works -->
|
||||
class TestSolution(unittest.TestCase):
|
||||
def test_simple(self):
|
||||
x = "Hello World"
|
||||
self.assertEqual(revstring(x), "dlroW olleH") # Test simple string reversal
|
||||
self.assertEqual(revstring(""), "") # Test empty string
|
||||
self.assertEqual(revstring("a"), "a") # Test single character
|
||||
self.assertEqual(revstring("racecar"), "racecar") # Test palindrome
|
||||
self.assertEqual(revstring("12345"), "54321") # Test numbers as string
|
||||
self.assertEqual(revstring("!@# $%"), "%$ #@!") # Test special chars and spaces
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,14 +0,0 @@
|
||||
import unittest
|
||||
|
||||
#<!-- The Function the User needs to write -->
|
||||
def revstring(x):
|
||||
return x[::-1]
|
||||
|
||||
#<!-- This Test, test if the function works -->
|
||||
class TestSolution(unittest.TestCase):
|
||||
def test_simple(self):
|
||||
x="";
|
||||
self.assertEqual(revstring(x), x[::-1])
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
1
problems/sortlist/description.md
Normal file
1
problems/sortlist/description.md
Normal file
@@ -0,0 +1 @@
|
||||
this is a easy sorting problem **it is solvable in less than 2 seconds**
|
||||
6
problems/sortlist/manifets.json
Normal file
6
problems/sortlist/manifets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"title": "Sort List",
|
||||
"description": "Sort a List with a Function (sortlist); the function is supposed to take the list as an argument and is supposed to return the sorted list and print it.",
|
||||
"description_md": "problems/sortlist/description.md",
|
||||
"test_code": "problems/sortlist/test.py"
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
import unittest
|
||||
|
||||
# This is the function the user is expected to write.
|
||||
# Its a really simple one, the user can choose not to type tho.
|
||||
def sortlist(lst = [4,3,2,1]) -> list:
|
||||
return sorted(lst)
|
||||
|
||||
class TestSolution(unittest.TestCase):
|
||||
def test_sort(self):
|
||||
# define x as a empty array.
|
||||
Reference in New Issue
Block a user