Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Created October 27, 2022 04:52
Show Gist options
  • Save RaMSFT/7156a3167ab17fe01b3496e6cede9f35 to your computer and use it in GitHub Desktop.
Save RaMSFT/7156a3167ab17fe01b3496e6cede9f35 to your computer and use it in GitHub Desktop.
def decrypt_shift_right_trans(decode_str):
"""Decode the given string (a step up the alphabest)
a -> c
b -> d
...
k -> m
o -> q
e -> g
..
z -> b
"""
decode_str = decode_str.lower()
trasn_from = "abcdefghijklmnopqrstuvwxyz"
trasn_to = "cdefghijklmnopqrstuvwxyzab"
table_string = decode_str.maketrans(trasn_from, trasn_to)
return decode_str.translate(table_string)
print(decrypt_shift_right_trans("fcjjm ucjamkc rm nwrfml..!!"))
print(decrypt_shift_right_trans("g yk pykcqf..."))
print(decrypt_shift_right_trans("wms'pc pcybgle gl kcbgsk"))
print(decrypt_shift_right_trans("njcyqc qszqapgzc rm kw qrmpgcq"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment