Discuss / Python / 练习打卡

练习打卡

Topic source
import mathdef quadratic(a, b, c):    deta = b * b - 4 * a * c    if deta < 0:        print('此方程无解!')        return    temp = math.sqrt(deta)    x1 = (-b + temp) / 2 * a    x2 = (-b - temp) / 2 * a    return x1, x2print(quadratic(2, 3, 1))print(quadratic(1, 3, -4))

  • 1

Reply