Skip to content

Commit b441dd4

Browse files
committed
fix and rewrite message code with format()
1 parent e2aa349 commit b441dd4

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

__pycache__/main.cpython-35.pyc

125 Bytes
Binary file not shown.

main.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@ def __init__(self, arg1, arg2):
66

77
def test(self):
88
message = (self.arg1 + " - this is arg1!")
9-
'''
9+
1010
message2 = (self.arg2 + " - this is arg2")
11-
12-
if self.arg2 != '':
13-
print("FirstTest class in runnging: " + message + " and " + message2)
14-
else:
15-
'''
16-
print("FirstTest class in runnging: " + message)
11+
12+
print("FirstTest class in runnging: " + message + " and " + message2)
13+
1714

1815
class SecondTest(FirstTest):
1916
def __init__(self, arg1, arg2, arg3):
2017
'''See on new arg3 parametr, I, add him in this new class, what was extended from parent FirstClass'''
2118
super().__init__(arg1, arg2)
2219
self.arg3 = arg3
20+
2321
def test2(self):
2422
message3 = self.arg3
2523

26-
print("New SecondTest class calling arg1: " + self.arg1 + ", arg2: " + self.arg2 + " from FirstClass from method test and arg3: "
27-
+ message3 + "from SecondTest class , test2() method")
24+
finalmsg = "New SecondTest class calling arg1: {argm1}, arg2: {argm2} from " \
25+
"FirstClass from method test and arg3: {argm3} " \
26+
"from SecondTest class , test2() method".format(argm1=self.arg1, argm2=self.arg2, argm3=message3)
27+
28+
print(finalmsg)

run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import main
22

3-
#Two = main.FirstTest("OnlyOneTestArgument")
3+
# Two = main.FirstTest("OnlyOneTestArgument")
44

55
First = main.FirstTest("TestArgument1", "TestArgument2")
66
Second = main.SecondTest("TestArgument1", "TestArgument2", "TestArgument3")
77

88
First.test()
99
Second.test2()
10-
#Two.test()
10+
# Two.test()

0 commit comments

Comments
 (0)