Another way to solve this is through the use of a lambda function:
discrim = lambda a,b,c: b**2 - 4*a*c
discrim(3,4,5)
Richard P.
asked 05/06/24The formula for computing the discriminant of a quadratic equation ax^2 + bx + c = 0 is b^2 – 4ac.
Write a program that computes the discriminant for the equation 3x^2 + 4x + 5 = 0.
Another way to solve this is through the use of a lambda function:
discrim = lambda a,b,c: b**2 - 4*a*c
discrim(3,4,5)
Iordan G. answered 05/06/24
Machine learning researcher and data scientist using Python
Here's one way:
def discriminant(a, b, c):
return b*b - 4*a*c
x = discriminant(3,4,5)
print(x)
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.