Я написал такое решение, для поиска максимально близкого значения я использую стандартное отклонение.
dataset = [
(7, 2, 7, 3, 7, 4, 4, 6),
(5, 6, 1, 7, 3, 7, 1, 6),
(3, 3, 4, 5, 4, 4, 4, 4),
(5, 7, 3, 3, 5, 4, 6, 8),
(5, 2, 5, 6, 5, 5, 6, 8),
(6, 4, 7, 5, 4, 5, 5, 7),
(7, 6, 8, 8, 7, 5, 7, 7),
(5, 12, 11, 8, 6, 11, 8, 6),
(4, 13, 9, 5, 1, 6, 6, 5),
(13, 7, 6, 14, 10, 4, 5, 14),
(8, 6, 7, 8, 12, 4, 3, 7),
(8, 3, 9, 10, 3, 1, 6, 10),
(4, 11, 7, 8, 6, 8, 3, 5)]
line = (6, 11, 2, 6, 6, 7, 10, 6)
def calculate_deviation(a, b):
return (sum((i - j) ** 2 for i, j in zip(a, b)) / min(len(a), len(b))) ** 0.5
min_sd = calculate_deviation(line, dataset[0])
answer = dataset[0]
for i in range(1, len(dataset)):
sd = calculate_deviation(dataset[i], line)
if sd < min_sd:
min_sd = sd
answer = dataset[i]
print(f"Ответ: {answer}")
print(f"Стандартное отклонение: {round(min_sd, 6)}")