We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
N
1 parent 52602ea commit 4879a46Copy full SHA for 4879a46
ciphers/rot13.py
@@ -1,4 +1,4 @@
1
-def dencrypt(s: str, n: int = 13) -> str:
+def dencrypt(s: str) -> str:
2
"""
3
https://en.wikipedia.org/wiki/ROT13
4
@@ -9,12 +9,13 @@ def dencrypt(s: str, n: int = 13) -> str:
9
>>> dencrypt(s) == msg
10
True
11
12
+ N = 13
13
out = ""
14
for c in s:
15
if "A" <= c <= "Z":
- out += chr(ord("A") + (ord(c) - ord("A") + n) % 26)
16
+ out += 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 += chr(ord("a") + (ord(c) - ord("a") + N) % 26)
19
else:
20
out += c
21
return out
0 commit comments