Nov-27-2019, 10:08 AM
A follow-up question on the same homework.
import numpy as np a = input('what is the coefficient for a? ') b = input('what is the coefficient for b? ') c = input('what is the coefficient for c? ') # calculate the discriminant d = (b**2)-(4*a*c) sol1 = (-b-np.sqrt(d))/(2*a) sol2 = (-b+np.sqrt(d))/(2*a) if d > 0.: print('There are two real roots which are ', sol1, 'and', sol2) elif d == 0.: print('There is one real root which is ', sol1) else: print ('There are no real roots ')Why does this not work??