From eaf69cabebee29f149c66c675d5938133811eb43 Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Tue, 7 Dec 2021 11:47:27 -0800 Subject: [PATCH] Add assert to rangesum JUUUUUUUST in case Signed-off-by: Alek Ratzloff --- day07/day07.py | 1 + 1 file changed, 1 insertion(+) diff --git a/day07/day07.py b/day07/day07.py index 199c6e2..84b5f31 100755 --- a/day07/day07.py +++ b/day07/day07.py @@ -4,6 +4,7 @@ from typing import Sequence def rangesum(rn: range): + assert rn.step == 1, "this function doesn't work when range step != 1" return (((rn.stop + 1) * rn.stop) // 2) - (((rn.start + 1) * rn.start) // 2)