小编Vla*_*byr的帖子

在if语句中使用布尔运算符

我是编码的初学者,我正在尝试使用python创建二次方程计算器.

while True:
    print("""
        Welcome to DJIGURDA Supreme Quadratic Calculator
        Please enter three values in the form of /'ax^2 + bx +c/'. """)
    a = input("a (first constant)")
    b = input("b (second constant)")
    c = input("c (third constant)")

    if not a.isalpha and not b.isalpha and not c.isalpha:
        d = (float(b)**2) - (4 * float(a) * float(c))
        print(d)
        if d >= 0:
            x_1 = (float(-b) + (d**0.5)) / (2*float(a))
            x_2 = (float(-b) - (d**0.5)) / (2*float(a))
            print("The first variable is equal …
Run Code Online (Sandbox Code Playgroud)

python if-statement calculator

0
推荐指数
1
解决办法
76
查看次数

标签 统计

calculator ×1

if-statement ×1

python ×1