ax^2 + bx + c = 0 x1 = (-b + sqrt(b^2 - 4ac))/(2a) x2 = (-b - sqrt(b^2 - 4ac))/(2a) ========================= input a, b, c y = compute sqrt(b^2 - 4ac) x1 = (-b + y) / (2a) x2 = (-b - y) / (2a) ========================= expanding computing y: first compute b^2 - 4ac if it is negative, give an error otherwise compute sqrt of that ========================== define function for y: first compute b^2 - 4ac if it is negative, give an error otherwise compute sqrt of that input a, b, c y = function for y x1 = (-b + y) / (2a) x2 = (-b - y) / (2a) ====================== def funcy(a, b, c): d = b ** 2 - 4 * a * c if d < 0: return -32341 else: return sqrt(d) a = float(input("Coefficient of x2: ")) b = float(input("Coefficient of x: ")) c = float(input("Last coefficient: ")) y = funcy(a, b, c) if y < 0: print("It has complex roots") else: x1 = (-b + y) / (2 * a) x2 = (-b - y) / (2 * a) print("The roots are", x1, "and", x2)