print('The function is %dX^2+%dX+%d=0' % (a,b,c))
deta = b * b - 4 * a * c
if deta > 0:
x1 = (-b + math.sqrt(deta)) / (2 * a)
x2 = (-b - math.sqrt(deta)) / (2 * a)
print('The solutions are %f and %f:'%(x1,x2))
elif deta == 0:
x = -b / (2 * a)
print('The solution is %f:' % x)
else:
xi = -b / (2 * a)
xj1 = math.sqrt(-deta)/ (2*a)
xj2 = -math.sqrt(-deta)/ (2*a)
print('The solutions are %f+%fi and %f-%fi'%(xi,xj1,xi,xj2))
诏屎孤儿
import math
def quadratic(a,b,c):