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 6c04620 commit 53181d1Copy full SHA for 53181d1
1 file changed
ciphers/rot13.py
@@ -9,15 +9,17 @@ def dencrypt(s: str, n: int = 13) -> str:
9
>>> dencrypt(s) == msg
10
True
11
"""
12
- out = ""
+ out = []
13
+
14
for c in s:
15
if "A" <= c <= "Z":
- out += chr(ord("A") + (ord(c) - ord("A") + n) % 26)
16
+ out.append(chr(ord("A") + (ord(c) - ord("A") + n) % 26))
17
elif "a" <= c <= "z":
- out += chr(ord("a") + (ord(c) - ord("a") + n) % 26)
18
+ out.append(chr(ord("a") + (ord(c) - ord("a") + n) % 26))
19
else:
- out += c
20
- return out
+ out.append(c)
21
22
+ return "".join(out)
23
24
25
def main() -> None:
0 commit comments