Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You received the receipts from your grocery run, and there is an encoded message for a small prize. Write a function that takes three

 You received the receipts from your grocery run, and there is an encoded message for a small prize. Write a  WUR q www W e def decipher_text (key1, key2, key3): >>> decipher_text ('Q', 'b', 'C') ('bNswqR') 'answer' >>> 

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') () **

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

What is chert?

Answered: 1 week ago

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago