def make_decrypter(f1, f2, f3): """Generates a "decrypter" function. >>> brutus3 = caesar_generator(3, sub) >>> brutus2 = caesar_generator(2, sub) >>> decrypter = make_decrypter(brutus2, mirror_letter, brutus3) >>> decrypter('yxwv') # brutus3(mirror_letter(brutus2('y'))) = 'a' 'abcd' """ f1, f2, f3 = looper(f1), looper(f2), looper(f3) return lambda cs: f3(f2(f1(cs)))
def make_encrypter(f1, f2, f3): """Generates an "encrypter" that applies a specific set of encryption functions on the message >>> caesar3 = caesar_generator(3, add) >>> caesar2 = caesar_generator(2, add) >>> encrypter = make_encrypter(caesar2, mirror_letter, caesar3) >>> encrypter('abcd') # caesar2(mirror_letter(caesar3('a'))) -> 'y' 'yxwv' """ f1, f2, f3 = looper(f1), looper(f2), looper(f3) return lambda ucs: f1(f2(f3(ucs)))
def make_decrypter(f1, f2, f3): """Generates a "decrypter" function. >>> brutus3 = caesar_generator(3, sub) >>> brutus2 = caesar_generator(2, sub) >>> decrypter = make_decrypter(brutus2, mirror_letter, brutus3) >>> decrypter('yxwv') # brutus3(mirror_letter(brutus2('y'))) = 'a' 'abcd' """ f1, f2, f3 = looper(f1), looper(f2), looper(f3) "*** YOUR CODE HERE ***" return lambda word: f3(f2(f1(word)))
def make_decrypter(f1, f2, f3): """Generates a "decrypter" function. >>> brutus3 = caesar_generator(3, sub) >>> brutus2 = caesar_generator(2, sub) >>> decrypter = make_decrypter(brutus2, mirror_letter, brutus3) >>> decrypter('yxwv') # brutus3(mirror_letter(brutus2('y'))) = 'a' 'abcd' """ f1, f2, f3 = looper(f1), looper(f2), looper(f3) def decry(message): return f3(f2(f1(message))) return decry
def make_encrypter(f1, f2, f3): """Generates an "encrypter" that applies a specific set of encryption functions on the message >>> caesar3 = caesar_generator(3, add) >>> caesar2 = caesar_generator(2, add) >>> encrypter = make_encrypter(caesar2, mirror_letter, caesar3) >>> encrypter('abcd') # caesar2(mirror_letter(caesar3('a'))) -> 'y' 'yxwv' """ f1, f2, f3 = looper(f1), looper(f2), looper(f3) "*** YOUR CODE HERE ***" return lambda word: f1(f2(f3(word)))
def make_encrypter(f1, f2, f3): """Generates an "encrypter" that applies a specific set of encryption functions on the message >>> caesar3 = caesar_generator(3, add) >>> caesar2 = caesar_generator(2, add) >>> encrypter = make_encrypter(caesar2, mirror_letter, caesar3) >>> encrypter('abcd') # caesar2(mirror_letter(caesar3('a'))) -> 'y' 'yxwv' """ f1, f2, f3 = looper(f1), looper(f2), looper(f3) def encry(message): return f1(f2(f3(message))) return encry
def make_decrypter(f1, f2, f3): """Generates a "decrypter" function. >>> brutus3 = caesar_generator(3, sub) >>> brutus2 = caesar_generator(2, sub) >>> decrypter = make_decrypter(brutus2, mirror_letter, brutus3) >>> decrypter('yxwv') # brutus3(mirror_letter(brutus2('y'))) = 'a' 'abcd' """ f1, f2, f3 = looper(f1), looper(f2), looper(f3) "*** YOUR CODE HERE ***" def decrypter(x): return f3(f2(f1(x))) return decrypter