如何让Python将多项式作为输入,同时保持用x代替实际值的能力?Python中的多项式作为输入
这里是我的尝试:
fx=input("Enter a Polynomial: ")
x=float(input("At wich position should the polynomial be evaluated: "))
while True:
print(eval("fx"))
continue
即出现是Python将只是评估FX为X,问题并不像我通过我的第二个输入了x的值。
试试'eval(fx)'。 –
这也做了工作。谢谢:-) –