用户应该输入 A、B 和 C 的值并得到二次方程的根。从数学上讲,我的代码给出了错误的答案:
print "Quadratic Formula Calculator!!!"
a = input("Please, enter value for A: ")
b = input("Please, enter value for B: ")
c = input("Please, enter value for C: ")
quad =(b**2 - 4 * a * c)
if quad >= 0:
quad ** 0.5
print "quad"
else:
print "can not compute"
solution1 = (-b + quad) / (2 * a)
solution2 = (b + quad) / (2 * a)
print " Solution 1!!!:", solution1
print " Soultion 2!!!:", solution2