Загрузка данных


import math

def solve(a, b, c):
    if a == 0 or b**2 - 4*a*c < 0: return "Сообщение"
    d = b**2 - 4*a*c
    if d == 0: return f"x1=x2={abs(-b/(2*a)):g}"
    return f"x1={(-b+math.sqrt(d))/(2*a):g}, x2={(-b-math.sqrt(d))/(2*a):g}"

tests = [
    (2, -5, 2, "x1=2, x2=0.5"), (3, 2, 5, "Сообщение"), (3, -12, 0, "x1=4, x2=0"),
    (0, 0, 10, "Сообщение"), (0, 0, 0, "Сообщение"), (0, 5, 17, "Сообщение"), 
    (9, 0, 0, "x1=x2=0")
]

for a, b, c, expected in tests:
    res = solve(a, b, c)
    print(f"Тест {a, b, c}:", "УСПЕШНО" if res == expected else f"ОШИБКА (получено {res})")