0
import math
import easygui as eg

eg.msgbox("This program solves quadratic equations Enter the values of a, b and c ")

a=eg.integerbox("enter a") 

負の数または 99 を超える数を入力しようとすると、整数ボックスで入力できません。これを回避する方法はありますか

b=eg.integerbox("enter b")

c=eg.integerbox("enter c")


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

if d < 0:
    eg.msgbox("There are no real solutions")
elif i == 0:
    x = (-b+math.sqrt(i))/(2*a)

    eg.msgbox("heres your solution: "), x
else:
    x1 = (-b+math.sqrt(i))/(2*a)
    x2 = (-b-math.sqrt(i))/(2*a)
    eg.enterbox(msg="you have 2 solutions", default=(x1,x2))
4

1 に答える 1