"""Encipher a letter, given a shift amount
>>> caesar_encipher_letter('a', 1)
"""Encipher a letter, given a shift amount
>>> caesar_encipher_letter('a', 1)
if letter in string.ascii_letters:
if letter in string.ascii_uppercase:
alphabet_start = ord('A')
if letter in string.ascii_letters:
if letter in string.ascii_uppercase:
alphabet_start = ord('A')
"""
enciphered = [caesar_encipher_letter(l, shift) for l in message]
return ''.join(enciphered)
def caesar_decipher(message, shift):
"""
enciphered = [caesar_encipher_letter(l, shift) for l in message]
return ''.join(enciphered)
def caesar_decipher(message, shift):
-def affine_encipher_letter(letter, multiplier=1, adder=0, one_based=True):
+def affine_encipher_letter(accented_letter, multiplier=1, adder=0, one_based=True):
"""Encipher a letter, given a multiplier and adder
>>> ''.join([affine_encipher_letter(l, 3, 5, True) \
"""Encipher a letter, given a multiplier and adder
>>> ''.join([affine_encipher_letter(l, 3, 5, True) \
if letter in string.ascii_letters:
if letter in string.ascii_uppercase:
alphabet_start = ord('A')
if letter in string.ascii_letters:
if letter in string.ascii_uppercase:
alphabet_start = ord('A')
"""
cipher_alphabet = keyword_cipher_alphabet_of(keyword, wrap_alphabet)
cipher_translation = ''.maketrans(string.ascii_lowercase, cipher_alphabet)
"""
cipher_alphabet = keyword_cipher_alphabet_of(keyword, wrap_alphabet)
cipher_translation = ''.maketrans(string.ascii_lowercase, cipher_alphabet)
def keyword_decipher(message, keyword, wrap_alphabet=0):
"""Deciphers a message with a keyword substitution cipher.
def keyword_decipher(message, keyword, wrap_alphabet=0):
"""Deciphers a message with a keyword substitution cipher.