Skip to content

Commit 251b910

Browse files
committed
Added solution of part1
1 parent 918fe09 commit 251b910

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def reverse(string):
2+
return string[::-1]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from reverse import reverse
2+
import unittest
3+
4+
5+
6+
class ReverseTestCase(unittest.TestCase):
7+
def test(self):
8+
test_string = "Hello, My name is Reza. Github user name:ni8mr"
9+
altered_string = "rm8in:eman resu buhtiG .azeR si eman yM ,olleH"
10+
result_string = reverse(test_string)
11+
self.assertEqual(altered_string, result_string)
12+
13+
if __name__=='__main__':
14+
unittest.main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from vowel_counter import vowel_counter
2+
import unittest
3+
4+
class VowelCounterTestCase(unittest.TestCase):
5+
def test(self):
6+
test_string = "Hello, My name is Reza. Github user name:ni8mr"
7+
expected_vowel_count = 14
8+
resulted_vowel_count = vowel_counter(test_string)
9+
self.assertEqual(expected_vowel_count, resulted_vowel_count)
10+
11+
if __name__=='__main__':
12+
unittest.main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def vowel_counter(string):
2+
count = 0
3+
for letter in string:
4+
if letter in ['A','E','I','O','U','a','e','i','o','u']:
5+
count = count + 1
6+
return count
7+

0 commit comments

Comments
 (0)