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.
defcaesarCipher(s,k):# Write your code herealphabet='abcdefghijklmnopqrstuvwxyz'k=k%26alphabet_rot=alphabet[k:]+alphabet[:k]result=[]foriinrange(len(s)):foridx,charinenumerate(alphabet):ifs[i]==char:result.append(alphabet_rot[idx])elifs[i]==char.upper():result.append(alphabet_rot[idx].upper())ifs[i].isalpha()==False:result.insert(i,s[i])return''.join(result)
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 →