Question: Python 3.6- Why is this program not working? Please fix any errors . And send indented correct source code with screenshot of output. Thanks. def

Python 3.6- Why is this program not working? Please fix any errors . And send indented correct source code with screenshot of output. Thanks.

def solve_quadratic(a, b, c): r1 = 0; r2 = 0; d = (b ** 2) - (4 * a * c) if a == 0: print ("f(x)= " + para1[0] + "X^2 + " + para1[1] + "x + " + para1[2] + " with x intercepts at ({0:.2f},0)".format( -c / b)) return   if d elif d == 0: x = (-b) / (2 * a) print("f(x)= " + para1[0] + "X^2 + " + para1[1] + "x + " + para1[2] + " with x intercepts at ({0:.2f},0)".format(x)) else: x1 = (-b + math.sqrt(d)) / (2 * a) x2 = (-b - math.sqrt(d)) / (2 * a) print ("f(x)= " + para1[0] + "X^2 + " + para1[1] + "x + " + para1[ 2] + " with x intercepts at ({1:.2f},0) and ({0:.2f},0)".format(x1, x2)) return  fname = "quadratic.txt" with open(fname) as f: content = f.readlines() for l in content: print(l) para1 = l.split() if len(para1) != 3: print("wrong amt of coefficients") continue; try: para=[float(x) for x in para1] except ValueError: print("invalid coefficeints/ constant") continue; solve_quadratic(*para) 

Python 3.6- Why is this program not working? Please fix any errors

My text file looks like this:

. And send indented correct source code with screenshot of output. Thanks.

I keep getting error:

def solve_quadratic(a, b, c): r1 = 0; r2 = 0; d =

My output should look like this:

(b ** 2) - (4 * a * c) if a ==

import math def solve_ quadratic(a, r1 = 01 d=(b** 2)-(4*a*c) if a == 0: ("f(x)= " + paral [0] -cl b)) print + "X"2 + " + paral [1] + "x + " -para 1 [2] + " with x intercepts at ({0: .2f), 0)".format ( 10 return if d

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!