Problem 4: Write a function called encode which takes a plaintext consisting only of the characters (Char) shown in the below table. The function receives a string and returns all the corresponding Dec encoding to each of the char in the list. Use a dictionary to solve the problem. If the string contains any characters that are not in the table it should return a message that the string contains a character that is out of reach. The case and space should

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18PE
icon
Related questions
Question

(python question)

 

Problem 4: Write a function called encode which takes a plaintext consisting only of the
characters (Char) shown in the below table. The function receives a string and returns all
the corresponding Dec encoding to each of the char in the list. Use a dictionary to solve the
problem. If the string contains any characters that are not in the table it should return a
message that the string contains a character that is out of reach. The case and space should
be ignored. For example if the user pass the encode('abe') the function should return [97, 98,
991
Dec
97
98
99
100
101
Char
a
b
с
d
e
Description
Latin small letter a
Latin small letter b
Latin small letter c
Latin small letter d
Latin small letter e
Transcribed Image Text:Problem 4: Write a function called encode which takes a plaintext consisting only of the characters (Char) shown in the below table. The function receives a string and returns all the corresponding Dec encoding to each of the char in the list. Use a dictionary to solve the problem. If the string contains any characters that are not in the table it should return a message that the string contains a character that is out of reach. The case and space should be ignored. For example if the user pass the encode('abe') the function should return [97, 98, 991 Dec 97 98 99 100 101 Char a b с d e Description Latin small letter a Latin small letter b Latin small letter c Latin small letter d Latin small letter e
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning