From 65ce7f1994b0f089afa228a5cc21f00fefa5c936 Mon Sep 17 00:00:00 2001 From: typosaurus Date: Sat, 25 Jul 2026 19:01:02 +0200 Subject: [PATCH] feat: add clamp_to_byte at the end of calculator --- src/calculator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calculator.py b/src/calculator.py index e41739a..da4a182 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -6,3 +6,7 @@ def add(left: int, right: int) -> int: def subtract(left: int, right: int) -> int: return left - right + + +def clamp_to_byte(value: int) -> int: + return max(0, min(255, value))