Discuss / Python / 作业

作业

Topic source

燕喜泥润

#1 Created at ... [Delete] [Delete and Lock User]

import math

def quadratic(a,b,c):

    det=b**2-4*a*c

    if a!=0 and det>=0:

        x1=(-b+math.sqrt(det))/(2*a)

        x2=(-b-math.sqrt(det))/(2*a)

        return x1,x2

    else:

        return "无解"


  • 1

Reply