subject

Mason and Meade designed an encryption method to exchange secret messages. There are two modes: 'odd' and 'even'. In the 'odd' mode, the actual letters are placed at odd positions (1st, 3rd, 5th letter, etc.) with random letters at even positions; while in the 'even' mode, the actual letters are placed at even positions (2nd, 4th, 6th letters, etc.) with random letters at other positions. Please construct a function decript that takes two arguments: a string type argument text, which is an encrypted text; and another string type argument mode, with a value of 'odd' or 'even'. The function has to print out the decripted text from the given text and mode. Below is two examples of how the function should be called: decrypt('ABCDEFGHIJK', 'odd') decrypt('LITLEOLVIETYPOAU', 'even') The output would be: ACEGIK ILOVEYOU Note: The index of a string starts from 0, i. e., the 1st letter is at index 0, the 2nd at index 1, etc.. print(text[1::2]) def decrypt(text, mode): print(text[1:2:]) if mode == 'odd': print(text[:2:]) elif mode == 'even': print(text[::2]). print(text[0,2,4,...]). print(text[1:-1:2]) print(text[0:-1:2]) print(text[,,2])

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
The editing of digital photos us about the same level of difficulty as editing an analog photo
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
question
Computers and Technology, 24.06.2019 04:30
How do you share someone else’s tweet with your own twitter followers?
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
Text or graphics that print at the bottom of every page are called footings footers headers headings
Answers: 1
You know the right answer?
Mason and Meade designed an encryption method to exchange secret messages. There are two modes: 'odd...
Questions
question
Mathematics, 08.03.2021 22:40
question
English, 08.03.2021 22:40
Questions on the website: 13722361