Answered You can hire a professional tutor to get the answer.

QUESTION

Hello everybody, I am Jack and I am new to python programming. I have come across a simple cipher program question but I got stuck on how to proceed...

Hello everybody, I am Jack and I am new to python programming. I have come across a simple cipher program question but I got stuck on how to proceed onwards.

The question is as follow (I do not mean to ask anyone to help me to complete the program but it would be grateful if anyone could give me some tips. : ) Thanks)

Question: Treat A as 0, B as 1, C as 2 ... Z as 25

Use the following formula to encrypt an input message into ciphertext (Assume the input string is in capital letters with no space):

c=(9×m+13)mod26

For example, if the input is "HELLO"

For H, H = 7

c = (9 * 7 +13) mod 26

c = 24

24 = Y.

So, we map H to Y

For E, E = 4

c = (9 * 4 +13) mod 26

c = 23

23 = X,

So, we map E to X

Then, we perform the same procedure for the remaining letters

The ciphertext will be "YXIIJ"

Example

Suppose user input the following: HELLO

The program output the following: YXIIJ

The following is the codes typed by myself:

d = {:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23, :24, :25}i = 0 word a[100]:c = (9* d[word] + 13) % 26a[i] = c i += 1 i a[100]:(i)
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question