import pickle
import os
from m1 import sred, colvo

def obrabotka():
    filename = input("Имя файла: ")
    if not os.path.exists(filename):
        print("Файл не найден!")
        return
    with open(filename, 'rb') as f:
        data = pickle.load(f)
        A, B = data[0], data[1]
    print(f"A: {A}")
    print(f"B: {B}")
    avg_A, avg_B, P = sred(A, B)
    print(f"\nСреднее A: {avg_A:.2f}")
    print(f"Среднее B: {avg_B:.2f}")
    print(f"Порог P: {P:.2f}")
    up_A, down_A = colvo(A, P)
    up_B, down_B = colvo(B, P)
    print(f"\nA: выше {up_A}, ниже {down_A}")
    print(f"B: выше {up_B}, ниже {down_B}")
    return [avg_A, avg_B, P]