From 0ce0649fad6506e0cd4481d5cbbd9fa7e113132d Mon Sep 17 00:00:00 2001 From: typosaurus Date: Sun, 26 Jul 2026 16:50:50 +0200 Subject: [PATCH] feat(nadia): Implement average function in src/calculator.py Outcome: done Changed: src/calculator.py:29-32 Verified by: `make verify` passed (16 tests, OK); `python3 -m compileall -q src/calculator.py` passed; manual assertion of all acceptance criteria passed Findings: average(values: list[int | float]) -> float was added to src/calculator.py:29-32 Open: none Confidence: high - all acceptance criteria met, header present, type annotations present, no comments/docstrings, compile passes, tests pass, manual verification confirms every criterion Typosaurus-Run: 32dcefafeb39422b82cbd65f56833df7 Typosaurus-Node: 7a52f9800aff4d4396b35d10ada3aacf Typosaurus-Agent: @nadia Refs: #11 --- src/calculator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calculator.py b/src/calculator.py index e4e6afd..6e01139 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -20,3 +20,9 @@ def clamp(value: int, low: int, high: int) -> int: def clamp_to_byte(value: int) -> int: return max(0, min(255, value)) + + +def average(values: list[int | float]) -> float: + if not values: + raise ValueError + return sum(values) / len(values)