Skip to content

Resolves issue #12306 #12319

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
Change N into lowercase
  • Loading branch information
Y-Srivaishnavi authored Oct 29, 2024
commit 3a98cdab6e8298452368f689bb7d1ee5c0311d2e
6 changes: 3 additions & 3 deletions ciphers/rot13.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ def apply_rot13(s: str) -> str:
"""
if not isinstance(s, str):
return "The input must be a string. Please try again."
N = 13
n = 13
out = ""
for c in s:
if "A" <= c <= "Z":
out += chr(ord("A") + (ord(c) - ord("A") + N) % 26)
out += chr(ord("A") + (ord(c) - ord("A") + n) % 26)
elif "a" <= c <= "z":
out += chr(ord("a") + (ord(c) - ord("a") + N) % 26)
out += chr(ord("a") + (ord(c) - ord("a") + n) % 26)
else:
out += c
return out
Expand Down