def quad(a, b, c):
solution1 = (-b + ((b**2 - 4 * a * c)**0.5)) / 2 * a
solution2 = (-b - ((b**2 - 4 * a * c)**0.5)) / 2 * a
return solution1, solution2
while True:
print "\nax^2 + bx + c = 0"
a = input("What does 'a' equal? ")
b = input("What does 'b' equal? ")
c = input("What does 'c' equal? ")
answera, answerb = quad(a, b, c)
print "(x -", str(answera) + ")(x -", str(answerb) + ") = 0"
print "x=" + str(answera) + ",x=" + str(answerb)
The code works for any numbers on 'b' and 'c', (within reason), but whenever 'a' is anything but 1, the code gives the wrong numbers, and I can't figure out what's wrong with it.