We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae11489 commit c0bd976Copy full SHA for c0bd976
exercises/Q5.py
@@ -0,0 +1,30 @@
1
+'''
2
+Question 5
3
+Level 1
4
+
5
+Question:
6
+Define a class which has at least two methods:
7
+getString: to get a string from console input
8
+printString: to print the string in upper case.
9
+Also please include simple test function to test the class methods.
10
11
+Hints:
12
+Use __init__ method to construct some parameters
13
14
15
16
17
18
+class InOutString(object):
19
+ def __init__(self):
20
+ self.str = "No Input Given"
21
22
+ def getString(self):
23
+ self.str = input("Type something")
24
25
+ def printString(self):
26
+ print(self.str)
27
28
+tst = InOutString()
29
+tst.getString()
30
+tst.printString()
0 commit comments