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, 21.06.2019 19:20
Number of megabytes of ram in a computer. qualitative or quantitative? because
Answers: 3
question
Computers and Technology, 22.06.2019 03:30
Identify at least three types of characteristics that you were asked about as you the computer identify a fruit.
Answers: 3
question
Computers and Technology, 22.06.2019 11:10
Which are not examples of chronic or persistent stress? moving
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
You know the right answer?
Mason and Meade designed an encryption method to exchange secret messages. There are two modes: 'odd...
Questions
question
Mathematics, 30.09.2019 00:10