Python Program to Solve Quadratic Equation

Python Program to Solve Quadratic Equation

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn  Python programming concepts. You can learn Python language at your own speed and time. One can learn concepts of Python language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Python Program to Solve Quadratic Equation
Python Program to Solve Quadratic Equation

Write a Python Program to Solve Quadratic Equation

PROGRAM: Python Program to Solve Quadratic Equation

/* Python Program to Solve Quadratic Equation */
import cmath

a = 1
b = 5
c = 6
d = (b**2) - (4*a*c)
sol1 = (-b-cmath.sqrt(d))/(2*a)
sol2 = (-b+cmath.sqrt(d))/(2*a)

print('The solution are {0} and {1}'.format(sol1,sol2)) OUTPUT:-
The solutions are (-3+0j) and (-2+0j)

Leave a Reply

Your email address will not be published. Required fields are marked *