We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0db072 commit 03a36b5Copy full SHA for 03a36b5
1 file changed
ciphers/a1z26.py
@@ -13,7 +13,19 @@ def encode(plain: str) -> list[int]:
13
"""
14
>>> encode("myname")
15
[13, 25, 14, 1, 13, 5]
16
+ >>> encode("")
17
+ Traceback (most recent call last):
18
+ ...
19
+ ValueError: input cannot be empty
20
+ >>> encode("Hello")
21
22
23
+ ValueError: input must contain only lowercase letters a-z
24
25
+ if not plain:
26
+ raise ValueError("input cannot be empty")
27
+ if not plain.islower() or not plain.isalpha():
28
+ raise ValueError("input must contain only lowercase letters a-z")
29
return [ord(elem) - 96 for elem in plain]
30
31
0 commit comments