if not isinstance(a,(int, float)):
raise TypeError('bad operand type')
if not isinstance(b,(int, float)):
if not isinstance(c,(int, float)):
if b**2-4*a*c >=0:
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)
else:
Sign in to make a reply
珍宝天天开心
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 b**2-4*a*c >=0:
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)
else:
raise TypeError('bad operand type')