Adegoke Obasa

*(e-papa)* Reputation Points: 13 [?]

Q&As Helped to Solve: 8 [?]

Skill Endorsements: 0 [?]

```
"""ADEGOKE OBASA, adegokeobasa@yahoo.com"""
"""this functions solves Quadratic equations
using the quadratic formula"""
from math import*
def quad(a,b,c):
"""solves quadratic equations of the form
aX^2+bX+c, inputs a,b,c,
works for all roots(real or complex)"""
root=b**2-4*a*c
if root <0:
root=abs(complex(root))
j=complex(0,1)
x1=(-b+j+sqrt(root))/2*a
x2=(-b-j+sqrt(root))/2*a
return x1,x2
else:
x1=(-b+sqrt(root))/2*a
x2=(-b-sqrt(root))/2*a
return x1,x2
#example
#print(quad(1,3,4))
#>>>
#((-0.17712434446770464+0.5j), (-0.17712434446770464-0.5j))
#print(quad(1,9,4))
#>>>
#(-0.46887112585072543, -8.5311288741492746)
```