Implement the quadratic_formula) function. The function takes 3 arguments, a, b, and c, and computes the two results of the quadratic formula -b+ V - 4ac 2a --b- dac 2a The quadratic formula) function returns the tuple (x1, x2). Ex: When a = 1, b=-5, and e = 6, quadratic formula) retuns (3, 2). Code provided in main py reads a single input line containing values for a, b, and a, 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 autput is: Solutions to 2x*2 + -3x + -77-0 xl -7 x2 - -5.50 - TODO: Import math module def quadratic_formula (a, b, c): # TODO: Compute the quadratic formula results in variables x1 and x2 return (x1, x2) def print_number (number, prefix_str): if float (int (number)) -- number: print (f'(prefix_str}{number:.0f}') else: print (f'(prefix_str}{number:.2f}') if main ": name Înput_line - input () split_line - input_line.split (" ") a - float (split_line[0]) b - float (split_line[1]) c - float (split_line[2]) solution - quadratic_formula (a, b, c) print (f'Solutions to (a:.0f}x^2 + {b:.0f}x + {c:.0f} - 0') print_number (solution(0], 'xl - ') print_number (solution [1], 'x2 - ')

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

this is a python code use the code provided and fill in the # lines with new & understandable code.

Implement the quadratic_formula) function. The function takes 3 arguments, a, b, and e, and computes the two results of the quadratic
formula:
-b+ v - dae
2a
-6 - V - dae
2a
The quadratic_formula() function returns the tuple (x1, x2). Ex: When a = 1, b = -5, and c = 6, quadratic_formula() retums (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
xl-7
x2 - -5.50
# TODO: Import math module
def quadratic_formula (a, b, c) :
# TODO: Compute the quadratic formula results in variables x1 and x2
return (x1, x2)
def print_number (number, prefix_str):
if float (int (number)) =- number:
print (f'(prefix_str}{number:.0f}')
else:
print (f'(prefix_str}{number: .2f}')
if
input_line -
split_line - input_line.split (" ")
a - float (split_line [0])
b - float (split_line[1])
c - float (split_line[2])
solution = quadratic_formula (a, b, c)
print (f'Solutions to (a:.0f}x^2 + {b:.0f}x + {c:.0f} = 0')
print_number (solution(0], 'x1 = ')
print_number (solution [1], 'x2 = ')
name
main
":
input ()
Transcribed Image Text:Implement the quadratic_formula) function. The function takes 3 arguments, a, b, and e, and computes the two results of the quadratic formula: -b+ v - dae 2a -6 - V - dae 2a The quadratic_formula() function returns the tuple (x1, x2). Ex: When a = 1, b = -5, and c = 6, quadratic_formula() retums (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 xl-7 x2 - -5.50 # TODO: Import math module def quadratic_formula (a, b, c) : # TODO: Compute the quadratic formula results in variables x1 and x2 return (x1, x2) def print_number (number, prefix_str): if float (int (number)) =- number: print (f'(prefix_str}{number:.0f}') else: print (f'(prefix_str}{number: .2f}') if input_line - split_line - input_line.split (" ") a - float (split_line [0]) b - float (split_line[1]) c - float (split_line[2]) solution = quadratic_formula (a, b, c) print (f'Solutions to (a:.0f}x^2 + {b:.0f}x + {c:.0f} = 0') print_number (solution(0], 'x1 = ') print_number (solution [1], 'x2 = ') name main ": input ()
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY