You are viewing a single comment's thread. Return to all comments →
Here is my Python solution!
def caesarCipher(s, k): code = "" k = k % 26 alphabet = "abcdefghijklmnopqrstuvwxyz" nalphabet = "abcdefghijklmnopqrstuvwxyz" alphabet = alphabet[k:] alphabet += nalphabet[0:k] for a in range(len(s)): print(s[a]) if s[a].isalpha(): if s[a].isupper(): code += alphabet[nalphabet.index(s[a].lower())].upper() else: code += alphabet[nalphabet.index(s[a])] else: code += s[a] return code
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 Python solution!