Collin D wrote:

UPDATE:
'

#import
from math import sqrt

# collect data
a = float(raw_input('Type a value: '))
b = float(raw_input('Type b value: '))
c = float(raw_input('Type c value: '))

# create solver
def solver(a,b,c):
    if b**2 - 4*a*c < 0:
        return 'No real solution.'
    else:
        sol1 = (-1 * b + (sqrt(b**2 - 4*a*c))) / 2*a
        sol2 = (-1 * b - (sqrt(b**2 - 4*a*c))) / 2*a
        return (sol1, sol2)

# execute
print solver(a,b,c)

TEST your code.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to