我的做法
    # 通过用户输入数字,并计算二次方程
    import math

    print(“ax^2 + bx + c = 0\n”)
    a = float(input(“Please input a:”))
    b = float(input(“Please input b:”))
    c = float(input(“Please input c:”))
    print(“Your equation is “ + str(a) + “x^2 “ + str(b) + “x “ + str(c) + “ = 0”)
    derta_0 = (b * 2) - (4 a c)
    if derta_0 >= 0:
    derta = math.sqrt(derta_0)
    x_1 = (-b + derta) / (2
    a)
    x_2 = (-b - derta) / (2 * a)
    print(“The solution of the equation are:” + str(x_1) + “ and “ + str(x_2))
    else:
    print(“The equation has no solution.”)

    感觉这个没什么难度。