# A python program to find roots of a # quadratic equation. import math data = raw_input("Enter a, b, c: ") dl = data.split(" ") a = float(dl[0]) b = float(dl[1]) c = float(dl[2]) if a == 0.0 and b == 0.0: print "Invalid data" elif a == 0.0: print "Linear equation: x =", -c/b else: disc = b*b - 4*a*c if disc < 0.0: print "No real root" elif disc == 0.0: print "Equal roots: x =", -b/2/a else: sqrtD = math.sqrt(disc) print "Roots are: x1 =", (-b+sqrtD)/2/a, "x2 =", (-b-sqrtD)/2/a