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


a, b, c = float(input("a: ")), float(input("b: ")), float(input("c: "))
x, x_end, dx = float(input("Xнач: ")), float(input("Xкон: ")), float(input("dX: "))

is_real = int(a * b * c) % 4 == 0
print(f"\n{'X':^10} | {'F':^12}\n" + "-" * 25)

while x <= x_end + 1e-9:
    try:
        if x < 3 and b != 0:
            f = a * x**2 - b * x + c
        elif x > 3 and b == 0:
            f = (x - a) / (x - c)
        else:
            f = x / c
            
        res = f"{f:.4f}" if is_real else f"{int(f)}"
    except ZeroDivisionError:
        res = "Деление на 0"
        
    print(f"{x:10.2f} | {res:>12}")
    x += dx