Answer to Question #336052 in Python for Venkatesh Reddy

Question #336052

your friend gave you an encrypted text. He encrypted the text using the Alphabet Square cipher. It is a simple substitution cipher that make use of a square grid. The letters a-z written into the grid, with i and j typically sharing a slot (as there are 26 letters and Only 25 slots).This cipher generally takes a plain text as input and gives encrypted text as output.

To encipher a message ,each letter is merely replaced by its row and columns numbers in the grid.

Your given an encrypted string S as input print the decrypted text using the Alphabet Square.

NOTE:The input contains lowercase letters as the string.


1
Expert's answer
2022-05-01T19:06:01-0400

d = {'11': 'a', '12': 'b', '13': 'c', '14': 'd', '15': 'e', '21': 'f', '22': 'g', '23': 'h', '24': 'i/j', '25': 'k', '31': 'l', '32': 'm', '33': 'n', '34': 'o', '35': 'p', '41': 'q', '42': 'r', '43': 's', '44': 't', '45': 'u', '51': 'v', '52': 'w', '53': 'x', '54': 'y', '55': 'z'}

encoded = list(input())

vals = []

for i in range(0, len(encoded), 2):

   vals.append(encoded[i] + encoded[i + 1])

for i in vals:

   print(d[i], end = "")


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS