from numpy import median, mean def func1(SPS, KL): return sorted(SPS, reverse=KL) def func2(data): return median(data), mean(data)