Jan-09-2018, 07:00 PM
self
act like a transportation between between class/method internally and in a inheritance setup.I have give example better names,so it kind of make sense.
class First(): def number_input(self): self.x = int(input("whats your first number?\n")) class Second(First): def result(self): z = self.x + 2 print(z)Test:
Output:>>> obj = Second()
>>> obj.number_input()
whats your first number?
50
>>> obj.result()
52