You are viewing a single comment's thread. Return to all comments →
python3
def caesarCipher(s, k): k = k % 26 lower = {chr(i): chr((i - ord('a') + k) % 26 + ord('a')) for i in range(ord('a'), ord('z') + 1)} upper = {chr(i): chr((i - ord('A') + k) % 26 + ord('A')) for i in range(ord('A'), ord('Z') + 1)} return ''.join([lower[char] if char in lower else upper[char] if char in upper else char for char in s])
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 →
python3