diff --git a/ciphers/a1z26.py b/ciphers/a1z26.py index a1377ea6d397..102cef4e424e 100644 --- a/ciphers/a1z26.py +++ b/ciphers/a1z26.py @@ -13,7 +13,13 @@ def encode(plain: str) -> list[int]: """ >>> encode("myname") [13, 25, 14, 1, 13, 5] + >>> encode("ABCD") + Traceback (most recent call last): + ... + ValueError: plain must contain only lowercase letters (a-z) """ + if not plain.islower() or not plain.isalpha(): + raise ValueError("plain must contain only lowercase letters (a-z)") return [ord(elem) - 96 for elem in plain]