Discuss / Python / my homework

my homework

Topic source

fressman

#1 Created at ... [Delete] [Delete and Lock User]
在此插入代码
import math
def quadratic(a,b,c):
    if (b**2-4*a*c)>0:
        return  ((-b+math.sqrt(b**2-4*a*c))/(2*a),(-b-math.sqrt(b**2-4*a*c))/(2*a))

    elif (b**2-4*a*c) ==0:
        return -b/(2*a)
    else:
        return ('none')
print (quadratic(2,3,1))
print (quadratic(1,2,1))

  • 1

Reply