if not isinstance(a+b+c,(int,float)):
raise TypeError('bad operand type')
if b**2-4*a*c<0:
print('no answer')
else:
x1=(-b+math.sqrt(b**2-4*a*c))/(2*a)
x2=(-b-math.sqrt(b**2-4*a*c))/(2*a)
return x1,x2
# /2*a 和 /(2*a)要区分
Sign in to make a reply
容蟹屡
if not isinstance(a+b+c,(int,float)):
raise TypeError('bad operand type')
if b**2-4*a*c<0:
print('no answer')
else:
x1=(-b+math.sqrt(b**2-4*a*c))/(2*a)
x2=(-b-math.sqrt(b**2-4*a*c))/(2*a)
return x1,x2
# /2*a 和 /(2*a)要区分