5
answers
0
watching
433
views
8 Oct 2018
Question 6.6 MARKS] Two friends like to send messages to each other, but they don't want anyone else to read the messages. To keep the messages private, they change each letter in the original message to a different letter of the alphabet. For every letter, they both know which letter will be substituted for it, which is called an encoding. The message will contain only lowercase letters. It will not contain whitespace, digits, or punctuation. The receiver of a secret message doesn't want to convert it back to the original message by hand. Instead, that person asks you to write a function to do it. Following the function design recipe, define a function that given a secret message and the encoding used, returns the original message. Choose a meaningful function name, and add a docstring that includes the type contract, the description, and two examples that return different values. You must choose the types to use to represent the data, and you will be marked not only on the correctness of the function, but also on your choice of data structures.
Question 6.6 MARKS] Two friends like to send messages to each other, but they don't want anyone else to read the messages. To keep the messages private, they change each letter in the original message to a different letter of the alphabet. For every letter, they both know which letter will be substituted for it, which is called an encoding. The message will contain only lowercase letters. It will not contain whitespace, digits, or punctuation. The receiver of a secret message doesn't want to convert it back to the original message by hand. Instead, that person asks you to write a function to do it. Following the function design recipe, define a function that given a secret message and the encoding used, returns the original message. Choose a meaningful function name, and add a docstring that includes the type contract, the description, and two examples that return different values. You must choose the types to use to represent the data, and you will be marked not only on the correctness of the function, but also on your choice of data structures.
22 Jun 2023
Already have an account? Log in
20 Feb 2022
Already have an account? Log in
Jean KeelingLv2
10 Oct 2018
Already have an account? Log in