Created
October 27, 2022 04:52
-
-
Save RaMSFT/7156a3167ab17fe01b3496e6cede9f35 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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