def quadratic(a, b, c):
if not isinstance(a, (int, float)):
raise TypeError("bad operand typr")
if not isinstance(b, (int, float)):
raise TypeError("bad operand typr")
if not isinstance(c, (int, float)):
raise TypeError("bad operand typr")
sqrtt = math.sqrt(bb - 4 a c)
if (sqrtt < 0):
return None
ans1 = (-1 b + sqrtt) / (2 a)
ans2 = (-1 b - sqrtt) / (2 * a)
return (ans1,ans2)
腾腾2318
def quadratic(a, b, c): if not isinstance(a, (int, float)): raise TypeError("bad operand typr") if not isinstance(b, (int, float)): raise TypeError("bad operand typr") if not isinstance(c, (int, float)): raise TypeError("bad operand typr") sqrtt = math.sqrt(bb - 4 a c) if (sqrtt < 0): return None ans1 = (-1 b + sqrtt) / (2 a) ans2 = (-1 b - sqrtt) / (2 * a) return (ans1,ans2)