def discrim(a, b, c):
x1, x2 = None, None
if a == 0:
if b == 0:
if c == 0:
# a = 0, b = 0, c = 0
x1 = 'All numbers'
return x1, x2
else:
# a = 0, b = 0, c <> 0
x1 = 'incurrect input'
return x1, x2
else:
if c == 0:
# a = 0, b <> 0, c = 0
x1 = 0
return x1, x2
else:
# a = 0, b <> 0, c <> 0
x1 = (-c) / b
return x1, x2
else:
if b == 0:
if c == 0:
# a <> 0, b = 0, c = 0
x1 = 0
return x1, x2
else:
# a <> 0, b = 0, c <> 0
x1 = ((-c) / a) ** 0.5
x2 = -(((-c) / a) ** 0.5)
return x1, x2
else:
if c == 0:
# a <> 0, b <> 0, c = 0
x1 = 0
x2 = ((-b) / a) ** 0.5
return x1, x2
d = (b ** 2) - (4 * a * c)
x1 = ((-b) + (d ** 0.5)) / (2 * a)
x2 = ((-b) - (d ** 0.5)) / (2 * a)
return x1, x2
a, b, c = float(input()), float(input()), float(input())
#a, b, c = 1, 2, 0
x1, x2 = discrim(a, b, c)
if type(x1) == type(complex()) or type(x2) == type(complex()):
print("complex number")
else:
print(x1, x2, sep=' ||| ')
Комментарии приветствуются