Jan-09-2018, 05:40 PM
starting with python here, and can't seem to use the inheritance properly.
I am aiming to use the user input for 'x' inside class first() inside class second(),
but the information doesn't follow past.
would love some help on this one, thanks!!
I am aiming to use the user input for 'x' inside class first() inside class second(),
but the information doesn't follow past.
would love some help on this one, thanks!!
class first(): def num1(self): x = int(input("whats your first number?\n")) print(x) class second(first): def num2(self): z = x + 2 print(z) both_classes = first() both_classes = second() both_classes.num1() both_classes.num2()