Answer to Question #196335 in Python for Navneet Gautam

Question #196335

1. Write a program to input co-efficients of a, b and c of a quadratic equation ax2 + bx + c = 0, where a = 0. Discriminant, D = b2- 4ac.If discriminant is 0 then print there is exactly one real root, if discriminant is positive then print there are two distinct roots, if discriminant is negative then print then there are no real roots.


1
Expert's answer
2021-05-20T18:20:12-0400
a = float(input('Please input a:'))
b = float(input('Please input b:'))
c = float(input('Please input c:'))
d = b * b - 4 * a * c
if d > 0:
    print('there are two distinct roots')
elif d == 0:
    print('there is exactly one real root')
else:
    print('there are no real roots')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS