Skip to content

Instantly share code, notes, and snippets.

@anddam
Last active October 25, 2016 08:32
Show Gist options
  • Select an option

  • Save anddam/f591520018a1067d50d0f39820622d09 to your computer and use it in GitHub Desktop.

Select an option

Save anddam/f591520018a1067d50d0f39820622d09 to your computer and use it in GitHub Desktop.
def garble_text(text):
'''Somehow garble text, swaps
a <=> z, b <=> y, c <=> x, etc
'''
replace_string = 'abcdefghijklm nopqrstuvwxyz'
replace_dict = {key: value for key, value in zip(replace_string, reversed(replace_string))}
result = ''
for char in text:
result += replace_dict[char]
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment