We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
n = []
m = k % 26
for i in s:
if i in string.ascii_letters:
asc = ord(i) + m
if asc > 122 and ord(i) in range(97, 123):
asc = asc - 26
if asc > 90 and ord(i) in range(65, 91):
asc = asc - 26
n.append(chr(asc))
else:
n.append(i)
return ''.join(n)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →
def caesarCipher(s, k):