I am very new to programming and im trying to call a method from one class to another class. I keep getting the error, "name 'quad' is not defined.
class problem(object):
def ask(problem):
problem = input("What type of problem are you trying to solve?
Quadratic, ").capitalize() #add more
if problem == "Quadratic":
quad.equation()
class quadratic(object):
def equation():
a = float(input('Enter a: '))
b = float(input('Enter b: '))
c = float(input('Enter c: '))
e = problem()
e.ask()
quad = quadratic()
The code isn't completely done as I am doing things one at a time, so anything helps.
I guess my question is, is there an easier way to call the method to the other class? Or am I just doing something wrong?
EDIT: I have since fixed my code. Thanks for helping.