Could you write function comments for def quadratic(a,b,c,x) And def print_quad(a,b,c,x) Please follow the comment rule.

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
Could you write function comments for def quadratic(a,b,c,x) And def print_quad(a,b,c,x) Please follow the comment rule.
# A FUNCTION COMMENT should include:
# * The function's name.
# * What the function does.
# * What each parameter does.
# * What, if anything, gets returned.
# * What can go wrong.
Transcribed Image Text:# A FUNCTION COMMENT should include: # * The function's name. # * What the function does. # * What each parameter does. # * What, if anything, gets returned. # * What can go wrong.
# function that returns the value of the quadratic function given the coefficients and the value x
def quadratic(a, b, c, x):
return a * x ** 2 + b * x + C
1
2
3
# function to print the value of a quadratic function given the coefficients and the value x
def print_quad(a, b, c, x):
print(f"At x = {x} , y = {quadratic(a, b, c, x)}")
7
9.
10
# get the coefficients from the user
11
a = float(input("Enter coefficient a: "))
b = float(input("Enter coefficient b: "))
C = float(input("Enter coefficient c: "))
12
13
14
15
16
17
# print the quadratic equation
print(f"Parabola y = {a} x^2 + {b} x + {c}")
18
# print the value of x and quadratic function for x values of (0, 1, 2, ......, 9)
for x in range(10):
print_quad(a, b, c, x)
19
20
21
22
# print the value of x and quadratic function for x values of (10, 100, .... , 10_000_000)
X = 10
23
24
25
26
27
power = 1
while power < 8:
print_quad(a, b, c, x ** power)
28
power += 1
29
Transcribed Image Text:# function that returns the value of the quadratic function given the coefficients and the value x def quadratic(a, b, c, x): return a * x ** 2 + b * x + C 1 2 3 # function to print the value of a quadratic function given the coefficients and the value x def print_quad(a, b, c, x): print(f"At x = {x} , y = {quadratic(a, b, c, x)}") 7 9. 10 # get the coefficients from the user 11 a = float(input("Enter coefficient a: ")) b = float(input("Enter coefficient b: ")) C = float(input("Enter coefficient c: ")) 12 13 14 15 16 17 # print the quadratic equation print(f"Parabola y = {a} x^2 + {b} x + {c}") 18 # print the value of x and quadratic function for x values of (0, 1, 2, ......, 9) for x in range(10): print_quad(a, b, c, x) 19 20 21 22 # print the value of x and quadratic function for x values of (10, 100, .... , 10_000_000) X = 10 23 24 25 26 27 power = 1 while power < 8: print_quad(a, b, c, x ** power) 28 power += 1 29
Expert 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