ответвлено от main/python-labs
15 строки
306 B
Python
15 строки
306 B
Python
import statistics
|
|
|
|
def mod2(list1, list2):
|
|
n = min(len(list1), len(list2))
|
|
if n == 0:
|
|
return 0.0
|
|
x = list1[:n]
|
|
y = list2[:n]
|
|
|
|
try:
|
|
correlation = statistics.correlation(x, y)
|
|
except statistics.StatisticsError:
|
|
correlation = 0.0
|
|
|
|
return correlation |