Discuss / Python / 复习了下一元二次方程╮( ̄▽ ̄")╭

复习了下一元二次方程╮( ̄▽ ̄")╭

Topic source

Resalee

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

def quadratic(a,b,c):
    dert = b**2-4*a*c;
    if dert>=0:
        x1 = (-b+math.sqrt(dert))/(2*a)
        x2 = (-b-math.sqrt(dert))/(2*a)
        return x1, x2
    else:
        return "无解"

  • 1

Reply