mirror of
https://github.com/octocat/Hello-World.git
synced 2026-06-04 14:17:09 +00:00
fix: apply bounty solution for src/calculate_average.py
This commit is contained in:
parent
7fd1a60b01
commit
1c9c9b38fb
5
src/calculate_average.py
Normal file
5
src/calculate_average.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def calculate_average(values: list[float]) -> float:
|
||||
"""Return the arithmetic mean of values, or 0 if the list is empty."""
|
||||
if not values:
|
||||
return 0
|
||||
return sum(values) / len(values)
|
||||
Loading…
Reference in New Issue
Block a user