Add a guard rail around Roman.i2r

This commit is contained in:
Dan Buch 2023-10-20 10:51:29 -04:00
parent 5b55118373
commit 345464d0d4
Signed by: meatballhat
GPG Key ID: A12F782281063434

View File

@ -102,6 +102,9 @@ class Roman:
@classmethod
def i2r(cls, i: int) -> str:
if i > 100_000:
raise ValueError(f"{i} is too silly")
r: list[str] = []
for int_val, roman_val in sorted(cls.ALL_REVERSE.items(), reverse=True):