import cmath a =5 b = 2 c = 1 # calculate the discriminant d = (b**2) - (4*a*c) # find two solutions sol1 = (-b-cmath.sqrt(d))/(2*a) sol2 = (-b+cmath.sqrt(d))/(2*a) print('root1 = {0} \nroot2 = {1}'.format(sol1,sol2))
root1 = (-0.2-0.4j) root2 = (-0.2+0.4j)