Skip to content

Commit f508903

Browse files
Exercise_5
1 parent 1e29da7 commit f508903

File tree

3 files changed

+64
-7
lines changed

3 files changed

+64
-7
lines changed

.idea/workspace.xml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Level_1/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,31 @@ def prog_2():
105105
print(l)
106106
print(t)
107107
# prog_2()
108+
109+
110+
# ========================= Question_5: ===========================================
111+
# Define a class which has at least two methods:
112+
# getString: to get a string from console input
113+
# printString: to print the string in upper case.
114+
# Also please include simple test function to test the class methods.
115+
#
116+
# Hints:
117+
# Use __init__ method to construct some parameters
118+
119+
class Class_1:
120+
def __init__(self, str_):
121+
self.str_ = str_
122+
123+
def getString(self):
124+
print("Enter string:")
125+
self.str_ = input()
126+
return
127+
def printString(self):
128+
return print(self.str_)
129+
130+
x = Class_1("Salom, Doston")
131+
x.printString()
132+
133+
134+
135+

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,32 @@ prog_2()
114114
```
115115
* * *
116116

117+
## Question_5: ##
118+
**Description:**
119+
120+
Define a class which has at least two methods:\
121+
* getString: to get a string from console input
122+
* printString: to print the string in upper case.
123+
* Also please include simple test function to test the class methods.
124+
125+
**Hints:**
126+
Use __init__ method to construct some parameters
127+
128+
```python
129+
class Class_1:
130+
def __init__(self, str_):
131+
self.str_ = str_
132+
133+
def getString(self):
134+
print("Enter string:")
135+
self.str_ = input()
136+
return
137+
138+
def printString(self):
139+
return print(self.str_)
140+
141+
x = Class_1("Salom, Doston")
142+
x.printString()
143+
```
144+
* * *
145+

0 commit comments

Comments
 (0)