If discriminant 0 then Two Distinct Real Roots exists for this equation. Where ab and c are real numbers and a is not equal to zero. Python program to solve quadratic equation.
In this python programming tutorial we will learn how to solve a quadratic equation.
Given a quadratic equation the task is solve the equation or find out the roots of the equation. Printing the full equation printThe Quadratic Equation is ax2 bx csep calculating discriminant d b2 - 4ac evaluating first root r1 -b cmathsqrtd 2a r2 -b - cmathsqrtd 2a prinring the roots printFirst root. If you have a quadratic equation of the form ax2 bx c 0 then Example. In this code what we basically do is that we get the 3 inputs from the user which are the values of ab and c in a quadratic equation of the form ax2bxc.