This code defines a function solve_quadratic(a, b, c)
which takes in the coefficients of a quadratic equation (ax^2 + bx + c = 0) and returns the two solutions. The solutions are calculated using the quadratic formula (-b ± √(b^2 – 4ac)) / 2a. The cmath
library is used to calculate the square root of the discriminant (b^2 – 4ac) so that the solutions can be returned as complex numbers. The function is then called with example values for a, b, and c, and the solutions are printed.

import cmath
def solve_quadratic(a, b, c):
# calculate the discriminant
disc = cmath.sqrt(b**2 - 4*a*c)
# find two solutions
sol1 = (-b + disc) / (2*a)
sol2 = (-b - disc) / (2*a)
return sol1, sol2
a = 1
b = 5
c = 6
print(solve_quadratic(a, b, c))