0
code to solve quadratic equation in python
3 Antworten
+ 4
from math import sqrt
a,b,c=input(),input(),input()
d=b*b-4*a*c
print("roots are",(-b+sqrt(d))/(2*a),(-b-sqrt(d))/(2*a)
+ 3
yes u may check and put in a try block also
+ 1
I personally prefer using d to check if there is a real answer, but yeah, @Vansh has the right of it