我是第一次尝试类,我想创建一个程序,要求用户输入 a、b 和 c,然后为打印语句中所述的方程形式求解 x。但是,我的类有问题,给我一个错误,我没有使用类中的变量,缺少 5 个位置参数。任何帮助都会很棒,非常感谢。
class EquationSolver:
def MonomialSolver(self,a,b,c,x):
a = input("Enter Input for a:")
b = input("Enter Input for b:")
c = input("Enter input for c:")
x = (c+b)/a
print("For the equation in the format ax-b=c, with your values chosen x must equal", x)
def PolynomialSolver(self,a,b,c,x):
a = input("Enter Input for a:")
b = input("Enter Input for b:")
c = input("Enter input for c:")
x = (c^2 + b) / a
print("For the equation in the format sqrt(ax+b) = c, with your values chosen x must equal", x)
MonomialSolver()
PolynomialSolver()
慕运维8079593
相关分类