You received the receipts from your grocery run, and there is an encoded message for a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You received the receipts from your grocery run, and there is an encoded message for a small prize. Write a function that takes three unique characters keyl, key2, key3 (as length-one strings) and returns an inner function that takes in a string cipher_text and returns a decoded new string (all in lowercase). How to decipher: Once you see a letter that is the same as one of the input characters (case insensitive, meaning B is the same as b), convert it with following rules: Rule One: • The letter is key1 and . The index of the character is odd -> convert to letter '' • The index of the character is even -> convert to letter 'e' Rule Two: • The letter is key2 and • The index of the character is odd-> convert to letter 'o' • The index of the character is even -> convert to letter 'a' Rule Three: • The letter is key3 -> convert to letter 'u' Example: DNS • Keyl is Q • Key2 is b Key3 is C Original string is bNsWqR Return Input a n S Reason Key2, index value is even(0) -> a Not one of the three keys Not one of the three keys WUR q www W e def decipher_text (keyl, key2, key3): >>> decipher_text('Q', 'b', 'C') ('bNswqR') 'answer' >>> decipher_text ('W', '3', 'Z¹) ('TESTYJZRCJDE') 'testyourcode' >>> decipher_text ('W', '3', 'Z¹) ('ONWTWST') 'onetest' Not one of the three keys Key1, index value is even(4) -> e Not one of the three keys www. >>> decipher_text('D', 's', 'c') (¹¹) ** You received the receipts from your grocery run, and there is an encoded message for a small prize. Write a function that takes three unique characters keyl, key2, key3 (as length-one strings) and returns an inner function that takes in a string cipher_text and returns a decoded new string (all in lowercase). How to decipher: Once you see a letter that is the same as one of the input characters (case insensitive, meaning B is the same as b), convert it with following rules: Rule One: • The letter is key1 and . The index of the character is odd -> convert to letter '' • The index of the character is even -> convert to letter 'e' Rule Two: • The letter is key2 and • The index of the character is odd-> convert to letter 'o' • The index of the character is even -> convert to letter 'a' Rule Three: • The letter is key3 -> convert to letter 'u' Example: DNS • Keyl is Q • Key2 is b Key3 is C Original string is bNsWqR Return Input a n S Reason Key2, index value is even(0) -> a Not one of the three keys Not one of the three keys WUR q www W e def decipher_text (keyl, key2, key3): >>> decipher_text('Q', 'b', 'C') ('bNswqR') 'answer' >>> decipher_text ('W', '3', 'Z¹) ('TESTYJZRCJDE') 'testyourcode' >>> decipher_text ('W', '3', 'Z¹) ('ONWTWST') 'onetest' Not one of the three keys Key1, index value is even(4) -> e Not one of the three keys www. >>> decipher_text('D', 's', 'c') (¹¹) **
Expert Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Children's Hospital & Clinics COO Julie Morath set out to change the culture by instituting a policy of blameless reporting, which encourages employees to report anything that goes wrong or seems...
-
What future directions may be interesting for comparative studies in corporate governance?
-
The birth rate in a certain city is 3.5% per year, and the death rate is 2% per year. Also, there is a net movement of population out of the city at a steady rate of 300 people per year. The...
-
How does liquidity risk affect money management?
-
Tony is a sole proprietor who owns 40 cabs doing business in Chicago under the name of Tonys Cabs. The companys total net worth is over one million dollars and Tony has personal assets totaling...
-
Forrest and Dan make boxes of chocolates for which the demand is uncertain. Forrest says. Thats life. On the other hand, Dan believes that some demand patterns exist that could be useful for planning...
-
Microsoft Corporation makes Xbox video game consoles. For Microsoft's financial year YYYY, please make use of the following provided information regarding the inventory of those Xbox consoles:...
-
In this mini-case, you will complete the test of details on accounts receivable for the 2019 audit of EarthWear Clothiers, Inc. The principal test of detail involves sending "confirmations" or...
-
An electric motor drives a coaxial rotor through a single-plate clutch which has two pairs of driving surfaces each 300 mm external and 120 mm internal diameter; the total spring load pressing the...
-
The various projects under NeGD are? a . . UMANG b . . Digiclock c . . Risk Assessment System d . . Model Assessment
-
Ben placed the capital received in a 7,800 high-interest time account with an annual interest rate of 8.37 percent (p.a.). The principal was in the account for 8 years and 186 days, when the interest...
-
What is the Net Present Value of the following cash flow stream? Year Cash Flow 0 - $ 1 , 1 4 5 1 $ 4 5 9 2 $ 3 8 3 3 $ 4 1 1 4 $ 2 6 6 Assume an interest rate of 1 6 % round off your answer by two...
-
What is the company's pretax cost of debt? (Do not round intermediate calculations and enter your answer as a percent rounded to 2 decimal places, e.g., 32.16.) b. If the tax rate is 21percent, what...
-
Agatha's Murder Inc. has just purchased and installed a piece of equipment for $1,000,000. The equipment can be sold off at the end of 5 years for $120,000. For tax purposes, the equipment belongs to...
-
The rate of change of certain population is given by the functionrp/(t) = 11.7e0.027t thousand people per year, where 't' is the number of yearsrafter 1990. In 1998 the population was 790, 000.r (a)...
-
The following processes constitute the air-standard Diesel cycle: 12: isentropic compression,23: constant-volume energy addition (T and P increase),34: constant-pressure energy addition (v...
-
Write a program in a class FlowerCounter that computes the cost of flowers sold at a flower stand. Five kinds of flowerspetunia, pansy, rose, violet, and carnationare stocked and cost, respectively,...
-
Write a program in a class CountFamiles that counts the number of families whose income is below a certain value. Read an integer k from the keyboard and then create an array of double values of size...
-
Create a JavaFX application that implements a short survey. The first question should ask the user for his or her favorite color and present the choices red, orange, blue, and green in radio buttons....
-
The magical elevator. There is a man who lives on the top floor of a very tall building. Every day he gets the elevator down to the ground floor to leave the building to go to work. Upon returning...
-
A murderer is condemned to death. He has to choose between three rooms. The first is full of raging fires, the second is full of assassins with loaded guns, and the third is full of lions that havent...
-
A man went outside without an umbrella or a raincoat, yet did not get wet.
Study smarter with the SolutionInn App