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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 04:20, milkshakegrande101
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy. a. a fire occurs on the premises, and the building isbadly damaged. b. a burglar steals some money and securities from anunlocked safe. c. a business computer is damaged by vandals whobreak into the shop after business hours. d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm. til
Answers: 2
image
Computers and Technology, 24.06.2019 04:30, NEUROPHARMACOLOGICAL
The ieee 802.11: defines standards for wireless local area network (wlan) communication protocols. identifies various computers or devices connected to a network. verifies any resource attached to another computer on a network that is different from the computer to which the user is logged on. connects multiple local area networks (lans) and wide area networks (wans).
Answers: 2
image
Computers and Technology, 24.06.2019 17:00, harlon852
The length of time that a slide appears before automatically advancing to the next slide can be set in the timing group under the transitions tab. transition to this slide group under the transitions tab. timing group in the master slide view. transition to this slide group in the master slide view.
Answers: 1
image
Computers and Technology, 25.06.2019 05:40, Juancr4539
How to make a negative number positive in excel
Answers: 3
You know the right answer?
Mason and Meade designed an encryption method to exchange secret messages. There are two modes: 'odd...

Questions in other subjects:

Konu
Computers and Technology, 12.07.2019 12:30