Hi Collin,
Here you go:
jmi...@atomant:~/tmp$ cat polycalc.py
#!/usr/bin/env python
from math import sqrt
def f(a, b, c):
if (b**2 - (4 * a * c)) < 0:
return None, None # Can't solve
x = (-1 * b) + (((b**2 - (4 * a * c)) ** 0.5) / (2 * a))
return (-1 * x), x
print "Polynomial Solver..."
print
while True:
a = float(raw_input("a: "))
b = float(raw_input("b: "))
c = float(raw_input("c: "))
x = f(a, b, c)
if None in x:
print "Can't solve!"
else:
print "x = -%0.2f" % x[0]
print "x = +%0.2f" % x[1]
jmi...@atomant:~/tmp$
cheers
James
--
http://mail.python.org/mailman/listinfo/python-list