How to solve quadratic formula using Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to solve quadratic formula using Python

How can i solve quadratic formula using Python.

2nd Dec 2020, 9:31 PM
Abdullahi Bello
Abdullahi Bello - avatar
3 Answers
+ 3
Prompt for values a, b, and c. Calculate the formula in two parts - the positive and the negative. Print the two results.
2nd Dec 2020, 9:38 PM
Brian
Brian - avatar
+ 3
Be careful: if b<0, - b - sqrt(delta) is very unstable (the error gets amplified) so you should use an alternate form of the quadratic formula: 2c/(-b+sqrt(delta)) Viceversa if b>0, - b+sqrt(delta) is unstable , so what you should use instead is: 2c/(-b-sqrt(delta))
2nd Dec 2020, 11:48 PM
Angelo
Angelo - avatar
0
thanks guys
23rd Dec 2020, 3:44 AM
Abdullahi Bello
Abdullahi Bello - avatar