Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
def quadratic _ formula ( a , b , c ) : # Calculate the discriminant delta = b * * 2 - 4 *
def quadraticformulaa b c: # Calculate the discriminant delta bac # Check if the discriminant is nonnegative if delta : # Calculate the two solutions using the quadratic formula xb deltaa xb deltaa return x x else: # If discriminant is negative, return None return None # Read input values for a b and c a b c mapfloat inputsplit # Call quadraticformula function solutions quadraticformulaa b c # Print the solutions if solutions is not None: x x solutions printfSolutions to axbx c printfxx:f printfxx:f else: printNo real solutions discriminant is negative
def quadraticformulaa b c:
# Calculate the discriminant
delta bac
# Check if the discriminant is nonnegative
if delta :
# Calculate the two solutions using the quadratic formula
xb deltaa
xb deltaa
return x x
else:
# If discriminant is negative, return None
return None
# Read input values for a b and c
a b c mapfloat inputsplit
# Call quadraticformula function
solutions quadraticformulaa b c
# Print the solutions
if solutions is not None:
x x solutions
printfSolutions to axbx c
printfxx:f
printfxx:f
else:
printNo real solutions discriminant is negative
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started