Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 1 . 1 0 LAB: Quadratic formula Implement the quadratic _ formula ( ) function. The function takes 3 arguments, a , b ,

11.10 LAB: Quadratic formula Implement the quadratic_formula() function. The function takes 3 arguments, a, b, and c, and computes the two results of the quadratic formula: See Image The quadratic_formula() function returns the tuple (x1, x2). Ex: When a =1, b =-5, and c =6, quadratic_formula() returns (3,2). Code provided in main.py reads a single input line containing values for a, b, and c, separated by spaces. Each input is converted to a float and passed to the quadratic_formula() function. Ex: If the input is: 2-3-77 the output is: Solutions to 2x^2+-3x +-77=0 x1=7 x2=-5.50 SEE UPLOADED IMAGE for better view 11.10 LAB: Quadratic formula Implement the quadratic_formula() function. The function takes 3 arguments, a, b, and c, and computes the two results of the quadratic formula:
[ x_1=-b+(b^2-4 a c)/2 a; x_2=-b-(b^2-4 a c)/2 a ]
The quadratic_formula0 function returns the tuple (x 1, x 2). Ex: When a=1, b=-5, and c=6, quadratic_formula() returns (3,2). Code provided in main.py reads a single input line containing values for a, b, and c, separated by spaces. Each input is converted to a float and passed to the quadratic_formula( function. Ex: If the input is:
[2-3-77]
the output is:
[ Solutions to 2 x^2+-3 x+-77=0; x 1=7; x 2=-5.50]
main.py 1 # Produces the roots of the given quadratic equation. # Does not consider overflow. Does not solve for imaginary roots. def quadratic_formula (a, b, c) : # Check if the solution is imaginary if b^**2-4^* a^* c<0 : return None, None x 1=(-b+. math .sqrt(b^**2-4^* a^* c))/2.0/ a x 2=(-b-. math. sqrt .(b^**2-4^* a^* c))/2.0/ a return \times 1,\times 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

What is one of the skills required for independent learning?Explain

Answered: 1 week ago

Question

Understand employee mentoring

Answered: 1 week ago

Question

Appreciate the importance of new-employee orientation

Answered: 1 week ago