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 herestrBuild=""foriins:if(str.isalpha(i)):asc=ord(i)+kif(i.isupper()andasc>90):whileasc>90:asc=asc-26strBuild+=chr(asc)elif(i.islower()andasc>122):whileasc>122:asc=asc-26strBuild+=chr(asc)else:strBuild+=chr(asc)else:strBuild+=iprint(strBuild)returnstrBuild
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 →
Here is my Python3 approach