THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

fix and rewrite message code with format()

master
Sergey S. Leleko 1 year ago
parent
commit
b441dd4562
3 changed files with 12 additions and 11 deletions
  1. BIN
      __pycache__/main.cpython-35.pyc
  2. +10
    -9
      main.py
  3. +2
    -2
      run.py

BIN
__pycache__/main.cpython-35.pyc View File


+ 10
- 9
main.py View File

@ -6,22 +6,23 @@ class FirstTest:
def test(self):
message = (self.arg1 + " - this is arg1!")
'''
message2 = (self.arg2 + " - this is arg2")
if self.arg2 != '':
print("FirstTest class in runnging: " + message + " and " + message2)
else:
'''
print("FirstTest class in runnging: " + message)
print("FirstTest class in runnging: " + message + " and " + message2)
class SecondTest(FirstTest):
def __init__(self, arg1, arg2, arg3):
'''See on new arg3 parametr, I, add him in this new class, what was extended from parent FirstClass'''
super().__init__(arg1, arg2)
self.arg3 = arg3
def test2(self):
message3 = self.arg3
print("New SecondTest class calling arg1: " + self.arg1 + ", arg2: " + self.arg2 + " from FirstClass from method test and arg3: "
+ message3 + "from SecondTest class , test2() method")
finalmsg = "New SecondTest class calling arg1: {argm1}, arg2: {argm2} from " \
"FirstClass from method test and arg3: {argm3} " \
"from SecondTest class , test2() method".format(argm1=self.arg1, argm2=self.arg2, argm3=message3)
print(finalmsg)

+ 2
- 2
run.py View File

@ -1,10 +1,10 @@
import main
#Two = main.FirstTest("OnlyOneTestArgument")
# Two = main.FirstTest("OnlyOneTestArgument")
First = main.FirstTest("TestArgument1", "TestArgument2")
Second = main.SecondTest("TestArgument1", "TestArgument2", "TestArgument3")
First.test()
Second.test2()
#Two.test()
# Two.test()

Loading…
Cancel
Save