Question: Python last week's script: print(input a, b and c for a quadratic equation ax^2+bx+c=0) a = float(input(a =)) b = float(input(b =)) c = float(input(c
Python

last week's script:
print("input a, b and c for a quadratic equation ax^2+bx+c=0")
a = float(input("a ="))
b = float(input("b ="))
c = float(input("c ="))
D = (b**2) - (4*a*c)
if D>0:
sol1 = (-b+D**0.5)/(2*a)
sol2 = (-b-D**0.5)/(2*a)
print("There are two solutions: {} and {}".format(sol1,sol2))
elif D==0:
sol3 = (-b)/(2*a)
print("There is one solution: {}".format(sol3))
elif D
print("There is no solution")
Keyword arguments: These are "extra" arguments of a function that is optional for the user to specify. Therefore, they are defined (pre-programmed) with a default value - the value that would be used by the function if the argument is not specified by the user. Instead of writing def f (x), you would define a keyword argument with def f(x=0) or def f(x=True) or whatever default value that would make sense for your function. Keyword arguments must go after positional arguments (the normal ones) and variable-length arguments. Exercise 10 Recall the script you wrote last week to print the roots of a quadratic curve. Transform that into a Python function where the y-intercept is a keyword argument that is 0 by default, and where the complex roots (for the case D
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
