Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

in python , i want to answer this question please.. thank you Write a Python pro

ID: 3919168 • Letter: I

Question

in python , i want to answer this question please..

thank you

Write a Python program that reads from the keyboard a word and displays the encrypted version of that word Assume that only the characters (A, D, I, R, Y) are allowed in the input word and that the encoding is as shown in the following table AID I R?Y | M | N A B T Character Encoded as For example the word RIY AID will be encoded as BATMAN. You need to use three functions, readWordO, encrypt) and display Encryption). readWordO is called by main) to read from the keyboard 6 characters. encryptO is called by main0 to convert the characters obtained from readWord) into corresponding encryptions as indicated in the table. displayEncryption) is called by main0 to display the encrypted word on the screen. Your program should check the validity of the user input. Notes: 1.

Explanation / Answer

Below is the code. Please give indentation correctly to avoid indentation errors. I have mentioned where to give tabs in the code. Please follow them.

Code:

====

inp = ""

encry = ""

def readWord():

<TAB>global inp

<TAB>inp = raw_input("Enter a word: ")

<TAB>invalid = 0

<TAB>for i in range(len(inp)):

<TAB><TAB>if(inp[i] == 'A' or inp[i] == 'D' or inp[i] == 'I' or inp[i] == 'R' or inp[i] == 'Y'):

<TAB><TAB><TAB>continue

<TAB><TAB>else:

<TAB><TAB><TAB>invalid = 1

<TAB>if(invalid==1):

<TAB><TAB>print "Invalid input"

<TAB>return inp

def encrypt():

<TAB>global encry

<TAB>global inp

<TAB>for i in range(len(inp)):

<TAB><TAB>if(inp[i] == 'A'):

<TAB><TAB><TAB>encry = encry+"M"

<TAB><TAB>elif(inp[i] == 'D'):

<TAB><TAB><TAB>encry = encry+"N"

<TAB><TAB>elif(inp[i] == 'I'):

<TAB><TAB><TAB>encry = encry+"A"

<TAB><TAB>elif(inp[i] == "R"):

<TAB><TAB><TAB>encry = encry+"B"

<TAB><TAB>elif(inp[i] == 'Y'):

<TAB><TAB><TAB>encry = encry+"T"

def displayEncryption():

<TAB>print encry

readWord()

encrypt()

displayEncryption()

Due to some limitations not able to attach the output screen. Please comment if you want it, so that I can attach it later.