I would like to create a Python class with 3 functions.
- Function 1 will ask the user to input one number.
- Function 2 will ask the user to input another number.
- Function 3 will multiply function 1 * function 2 and return to the product.
Here is the code I have so far:
class Product:
def __init__(self, x, y):
self.x = x
self.y = y
def get_x(self):
x = int(input('What is the first number?: ')
def get_y(self):
y = int(input('What is the second number?: ')
def mult_XY(self):
return x * y
When I try calling on the class I get 'y' is not defined.
I tried using the following code:
num = Product(x, y)
print(num.mult_XY)