-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain (1).py
More file actions
27 lines (19 loc) · 823 Bytes
/
Copy pathmain (1).py
File metadata and controls
27 lines (19 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Instructions:
1. Create a class named ReversedString that inherits from StringOperations class
2. Implement the function reverse
3. reverse function should be a one liner function that returns the reverse string to_be_reversed
4. Instantiate the class ReversedString
5. Print to show your function implementation result
"""
class StringOperations:
def reverse(self, *, to_be_reversed: str = None):
raise NotImplementedError
# ---- class inherits from StringOperations class: ----
class ReversedString(StringOperations):
def reverse(self, *, to_be_reversed: str = None):
return to_be_reversed[::-1]
# ---- Instantiate the class ReversedString: ----
var1 = ReversedString()
# ---- Print to show the function implementation result: ----
print(var1.reverse(to_be_reversed="Hi, i'm Dena!"))