import math def solve_quadratic(a, b, c): discriminant = b**2 - 4*a*c if discriminant >= 0: root1 = (-b + math.sqrt(discriminant)) / (2*a) root2 = (-b - math.sqrt(discriminant)) / (2*a) return f"Root 1: {root1}\nRoot 2: {root2}" else: return "No real roots" a = 2 b = -7 c = 3 result = solve_quadratic(a, b, c) print(result)
Run
You can execute any Python code. Just enter something in the box above and click the button.
Output: