Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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.
expand button
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
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY