if not isinstance(a, (int, float)):
raise TypeError('bad operand type')
if not isinstance(b, (int, float)):
raise TypeError('bad operand type')
if not isinstance(c, (int, float)):
raise TypeError('bad operand type')
if a == 0:
raise TypeError('a不能等于0')
delta = b**2 - 4*a*c
if delta >= 0:
x = (-b + math.sqrt(delta)) / (2*a), (-b - math.sqrt(delta)) / (2*a)
else:
x = "此方程无实数解"
return x
喜欢游水的旱鸭子