Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Last active October 27, 2022 04:52
Show Gist options
  • Save RaMSFT/1ebdfce507d732eceef19cf415586750 to your computer and use it in GitHub Desktop.
Save RaMSFT/1ebdfce507d732eceef19cf415586750 to your computer and use it in GitHub Desktop.
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