From 05e77ebb09cf58ca84703d7d1394dc9d1e770190 Mon Sep 17 00:00:00 2001 From: PodolskyNK Date: Fri, 19 Dec 2025 10:29:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=9E=D0=9A=D0=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TEMA8/task.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/TEMA8/task.md b/TEMA8/task.md index 5ea48d4..f324e8e 100644 --- a/TEMA8/task.md +++ b/TEMA8/task.md @@ -30,13 +30,15 @@ def reading (file): #okz2.py import math + def correlation(a1, a2): -  n = min(len(a1), len(a2)) -  sum1 = sum(a1) -  sum2 = sum(a2) -  sum1sq = sum(now ** 2 for now in a1) -  sum2sq = sum(now ** 2 for now in a2) -  sum12 = sum(x * y for x, y in zip(a1, a2)) + n = min(len(a1), len(a2)) + + sum1 = sum(a1[:n]) + sum2 = sum(a2[:n]) + sum1sq = sum(now ** 2 for now in a1[:n]) + sum2sq = sum(now ** 2 for now in a2[:n]) + sum12 = sum(x * y for x, y in zip(a1[:n], a2[:n]))   part1 = n * sum12 - sum1 * sum2   part2 = math.sqrt((n * sum1sq - sum1 ** 2) * (n * sum2sq - sum2 ** 2)) @@ -64,7 +66,7 @@ if arr1 is None or arr2 is None: else:   corr = correlation(arr1, arr2)   if corr is not None: -  print(f"Коэффициент корреляции: {corr:.2f}") +  print(f"Коэффициент корреляции: {corr:.3f}") #Проверка