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")
when I try to enter a negative number or a number over 99 the integer box wont let me, Is there any way around this
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))
Try changing the default parameters of the function
integerbox
when you call it. Specifically, the one you'll want to change to allow negative numbers islowerbound
. Here is the full definition ofintegerbox
so you can see all the parameters.The minimum value for an integer on any platform can be accessed through the following method:
The upperbound for an int can be accessed through
sys.maxint
.