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.
def caesarCipher(s, k):
low='abcdefghijklmnopqrstuvwxyz'
up= low.upper()
new=''
for i in s:
if i in low:
real_r= (low.index(i)+k)%26
new+= low[real_r]
elif i in up:
real_r= (up.index(i)+k)%26
new+= up[real_r]
else:
new+= i
return new
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 →