Quadratic Equation Roots A B C in Python Programming Language Basics 2021

Quadratic Equation Roots A B C in Python Programming Language Basics 2021


Learn python online, full course python, easy learning



About the program: 

We are now writing the program in python language to solve the  quadratic equation in an easy way 


Explanation: 

TO solve the quadratic equation in python language you need to first take three alphabets A, B, and C

->  We need to write these three alphabets along with the float data type 

-> and also we need to write the condition for the calculation purpose 


Source code: 


# import complex math module  import cmath  

a = float(input('Enter a: '))  

b = float(input('Enter b: '))  

c = float(input('Enter c: '))  


# calculate the discriminant  

d = (b**2) - (4*a*c)  


# find two solutions 

 sol1 = (-b-cmath.sqrt(d))/(2*a)  

sol2 = (-b+cmath.sqrt(d))/(2*a)  

print('The solution are {0} and {1}'.format(sol1,sol2))   


solving quadratic equation in python

copyrights: java point

Post a Comment

Previous Post Next Post