Still pretty new to coding. I posted that Twin Primes Finder the other day and you guys were a great help so thanks. Here's my quadratic equation solver:
import math
#variables for initial equation
a = int(raw_input("Enter a:"))
b = int(raw_input("Enter b:"))
c = int(raw_input("Enter c:"))
#variables for quad. equation
negative_b = -b
b_squared = b**2
four_a_c = 4*a*c
determinant = b_squared - four_a_c
#prints initial equation
equation = [str(a)+"x^2", str(b)+"x", str(c)]
print "Solve: " + " + ".join(equation)
if determinant < 0:
print "No real solutions."
elif a == 0:
y_int = float(-c)/b
print "x =", y_int
print "But this is a straight line."
else:
root_determinant = math.sqrt(determinant)
two_a = 2*a
numerator_one = negative_b - root_determinant
answer_one = numerator_one/two_a
if determinant == 0:
print "x =", answer_one
else:
numerator_two = negative_b + root_determinant
answer_two = numerator_two/two_a
print "x =", answer_one, "or", answer_two