Last active
October 27, 2022 04:52
-
-
Save RaMSFT/1ebdfce507d732eceef19cf415586750 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 encrypt_shift_left_trans(decode_str): | |
"""encode the given string (a step down to next alphabest) | |
a <- c | |
b <- d | |
... | |
k <- m | |
o <- q | |
e <- g | |
.. | |
z <- b | |
""" | |
decode_str = decode_str.lower() | |
trasn_from = "cdefghijklmnopqrstuvwxyzab" | |
trasn_to = "abcdefghijklmnopqrstuvwxyz" | |
table_string = decode_str.maketrans(trasn_from, trasn_to) | |
return decode_str.translate(table_string) | |
print(encrypt_shift_left_trans("Hello Welcome to Python..!!")) | |
print(encrypt_shift_left_trans("I am Ramesh...")) | |
print(encrypt_shift_left_trans("You're reading in Medium")) | |
print(encrypt_shift_left_trans("Please subscribe to my stories")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment