# This program solves for roots of quadratic equations # (ones of the form ax^2 + bx + c = 0). # It is a demonstration of returning multiple values. import math # Computes/returns the roots of the quadratic equation # with the given integer coefficients a, b, and c. def quadratic(a, b, c): disc = math.sqrt(b * b - 4 * a * c) root1 = (-b + disc) / (2 * a) root2 = (-b - disc) / (2 * a) return root1, root2 def main(): r1, r2 = quadratic(1, -5, 6) print("The roots are", r1, "and", r2) r1, r2 = quadratic(2, 6, 4) print("The roots are", r1, "and", r2) main()