In [1]:
from functools import partial
In [2]:
ciphertext = 'vclguba-abgrobbx'
In [3]:
substitution_map_rot13 = dict(zip('abcdefghijklmnopqrstuvwxyz', 'nopqrstuvwxyzabcdefghijklm'))
In [4]:
substitute = lambda mapping, data: ''.join(mapping.get(c, c) for c in data)
In [5]:
rot13 = partial(substitute, substitution_map_rot13)
In [6]:
plaintext = rot13(ciphertext)
In [7]:
plaintext
Out[7]:
'ipython-notebook'
In [ ]: