我收到类型错误,我不确定为什么

I'm getting a type error and I'm not sure why

我正在使用 Python 2.5。我不确定出了什么问题。我已经尝试了一百万种不同的方法,但我很困惑。

这是我的代码:

import math

quad_function = "(a * x^2) + b * x + c"
print "A quadratic function is:" + quad_function

a_input = raw_input("Is 'a' given?")
b_input = raw_input("Is 'b' given?")
c_input = raw_input("Is 'c' given?")
x_input = raw_input("Are any of the solutions         given?")

if a_input == "yes":
    a = int(raw_input("What is 'a'?"))
if b_input == "yes":
    b = int(raw_input("What is 'b'?"))
if c_input == "yes":
    c = int(raw_input("What is 'c'?"))
if x_input == "one":
    x_1 = int(raw_input("What is the first     solution?"))
if x_input == "both":
    x_1 = int(raw_input("What is the first solution"))
x_2 = int(raw_input("What is the second solution"))

print 'The quadratic function is:' + str(a) + 'x^2'     + '+' + str(b) + 'x' + "+" + str(c)

d = b ** 2 - 4*a*c
if d > 1:
    num_roots = 2
if d == 1:
    num_roots = 1
if d < 1:
    num_roots = 0
print "There are " + str(num_roots) + " roots"

if x_input == "no" and d > 2 and a_input == 'yes' and b_input == 'yes' and c_input == 'yes':
x1 = float(((-b) + math.sqrt(d))/(2*a))
x2 = float(((-b) - math.sqrt(d))/(2*a))
print "The two solutions are: " + str(x1) * "and " + str(x2)

您在本应使用加号的地方使用了星号。替换

print "The two solutions are: " + str(x1) * "and " + str(x2)

print "The two solutions are: " + str(x1) + "and " + str(x2)