Skip to content

Fix 12306 used list instead of string in rot13.py and removed n #12363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 8, 2024
commit 1f681f5b9724d73e6c20aa473a30d8921eb13d0b
4 changes: 2 additions & 2 deletions ciphers/rot13.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ def dencrypt(s: str) -> str:
True
"""
out = []
n=13
n = 13
for c in s:
if "A" <= c <= "Z":
out += chr(ord("A") + (ord(c) - ord("A") + n) % 26)
elif "a" <= c <= "z":
out += chr(ord("a") + (ord(c) - ord("a") + n) % 26)
else:
out += c
return ''.join(out)
return "".join(out)


def main() -> None:
Expand Down
Loading