mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-20 08:12:02 +00:00
Change N
into lowercase
This commit is contained in:
parent
92d58b7109
commit
3a98cdab6e
|
@ -14,13 +14,13 @@ def apply_rot13(s: str) -> str:
|
||||||
"""
|
"""
|
||||||
if not isinstance(s, str):
|
if not isinstance(s, str):
|
||||||
return "The input must be a string. Please try again."
|
return "The input must be a string. Please try again."
|
||||||
N = 13
|
n = 13
|
||||||
out = ""
|
out = ""
|
||||||
for c in s:
|
for c in s:
|
||||||
if "A" <= c <= "Z":
|
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":
|
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:
|
else:
|
||||||
out += c
|
out += c
|
||||||
return out
|
return out
|
||||||
|
|
Loading…
Reference in New Issue
Block a user