Question: using python Write a function that returns the two roots of a quadratic equation as a tuple of complex values. Structure the program as follows
using python
Write a function that returns the two roots of a quadratic equation

as a tuple of complex values.
Structure the program as follows so that the program when run, prints the roots for the following three cases:

Program structure
import math
class complex: re = 0 im = 0 def __init__(self,r,i): self.re = r self.im = i def format(self): return "{}{:+f}i".format(self.re,self.im)
def solvequadratic(a,b,c):
.
.
return (complex( , ),complex( , ))
#____main____
a= solvequadratic(5,1,2)
print ("5x^2 + x + 2 = 0 -> x= ", a[0], " or ", a[1])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
