Skip to content

Commit 30d6e6a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 28399f5 commit 30d6e6a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

maths/moving_average.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import List
22

3+
34
def moving_average(values: List[float], window: int) -> List[float]:
45
"""
56
Compute the moving average of a list of numbers with a given window size.
@@ -15,4 +16,6 @@ def moving_average(values: List[float], window: int) -> List[float]:
1516
"""
1617
if window > len(values):
1718
raise ValueError("Window size cannot be larger than list length.")
18-
return [sum(values[i:i+window]) / window for i in range(len(values)-window+1)]
19+
return [
20+
sum(values[i : i + window]) / window for i in range(len(values) - window + 1)
21+
]

0 commit comments

Comments
 (0)