The decoder dictionary consists of integer keys that represent codes. The value of each key is a single character string.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

python code easy way please

decoder =
{88: "P', 121: 'у', 116: 't', 104: 'h', 111: 'о', 110: 'n', 105: 'i', 115: 's', 99: 'с', 108: '1',
46: '.', 32: ' ', 44: ',', 45: '-', 95: '_', 40: '(', 42: '*', 41: ')', 47: '/', 92: '\', 61: '='
124: '|', 96:
msgl
msg2
[32, 32, 47, 32, 111, 32, 92], [32, 40, 95, 47, 32, 92, 95, 41, 32]]
msg3 = [[32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40], [32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 41], [32, 32,
32, 32, 32, 95, 95, 46, 46, 45, 45, 45, 46, 46, 95, 95], [32, 44, 45, 61, 39, 32, 32, 47, З2, 32, 124, 32,
32, 92, 32, 32, 96, 61, 45, 46], [58, 45, 45, 46, 46, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 46, 46, 45,
45, 59], [32, 92, 46, 44, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 44, 46, 47]]
39:
58: ':', 59: ';'}
[[80, 121, 116, 104, 111, 110], [105, 115], [99, 111, 111, 108, 46]]
[[32, 32, 32, 44, 45, 46], [32, 95, 40, 42, 95, 42, 41, 95], [40, 95, 32, 32, 111, 32, 32, 95, 41],
%3D
%3D
%3D
Transcribed Image Text:decoder = {88: "P', 121: 'у', 116: 't', 104: 'h', 111: 'о', 110: 'n', 105: 'i', 115: 's', 99: 'с', 108: '1', 46: '.', 32: ' ', 44: ',', 45: '-', 95: '_', 40: '(', 42: '*', 41: ')', 47: '/', 92: '\', 61: '=' 124: '|', 96: msgl msg2 [32, 32, 47, 32, 111, 32, 92], [32, 40, 95, 47, 32, 92, 95, 41, 32]] msg3 = [[32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40], [32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 41], [32, 32, 32, 32, 32, 95, 95, 46, 46, 45, 45, 45, 46, 46, 95, 95], [32, 44, 45, 61, 39, 32, 32, 47, З2, 32, 124, 32, 32, 92, 32, 32, 96, 61, 45, 46], [58, 45, 45, 46, 46, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 46, 46, 45, 45, 59], [32, 92, 46, 44, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 44, 46, 47]] 39: 58: ':', 59: ';'} [[80, 121, 116, 104, 111, 110], [105, 115], [99, 111, 111, 108, 46]] [[32, 32, 32, 44, 45, 46], [32, 95, 40, 42, 95, 42, 41, 95], [40, 95, 32, 32, 111, 32, 32, 95, 41], %3D %3D %3D
For task2, you'll use four variables in the starting code: decoder, msg1, msg2, msg3.
The decoder dictionary consists of integer keys that represent codes. The value of each key is a single character string.
The message strings (msg1, msg2, msg3) are lists of lists. Each inner list is a sequence of integers (code) that represents a
character in a string. Use the decoder dictionary to look up the correct character to convert the list to a string.
See diagram below:
The decoder variable is a dictionary where the key in an integer
(code) and the associated value is a string with a single character.
decoder = { code: 'Y', code:'Z', code:'X' }
The msg1 variable(s) [there are three in your lab, msg1, msg2, msg3] are lists of lists.
Each inner list is a set of code numbers that represent a single
character in a string.
msg1 = [ [code, code, code, .., code],
, [code, code, code .., code] ]
Convert the lists of codes to a string
[code, code, ., code]
Final string
decoder
Use the dictionary to
[code, code, ., code]
"String1"
"StringN"
decode the codes into
their associated characters.
Example
decoder
{ 80: 'H', 14:'o', 101: 'e', 93:'1'}
%3D
code list
decoded by dictionary
-> 'H', 'e', 'l', 'l', 'o'
final string
"Hello"
[ве, 101, 93, 93, 14]
Task 2 is to decode all three messages and print them out. In the following, I show the results of decoding messages: msg1, msg2.
I'm not showing msg3, so you can find out what it is on your own. Your output needs to have all three strings.
You have complete freedom to implement this task in anyway you want as long as the output is correct. You may introduce your
own functions. Before printing each message, print the message ID (i.e., 1, 2, or 3) above it as shown below:
Task 2
Example for msg1
Message 1
Python
is
----
---
msg1 = [[80, 121, 116, 184, 111, 110],
[105, 115], [99, 111, 111, 188, 46]]
msg1 variable is a list of 3 lists.
Each list is decoded with the help of the decoder
cool.
Message 2
---
dictionary to produce three strings as described
above.
_(*_*)_
Print each string on its own line to get the final
/ 0\
(_/ _)
Message 3
(message 3 not show)
decoded message.
Transcribed Image Text:For task2, you'll use four variables in the starting code: decoder, msg1, msg2, msg3. The decoder dictionary consists of integer keys that represent codes. The value of each key is a single character string. The message strings (msg1, msg2, msg3) are lists of lists. Each inner list is a sequence of integers (code) that represents a character in a string. Use the decoder dictionary to look up the correct character to convert the list to a string. See diagram below: The decoder variable is a dictionary where the key in an integer (code) and the associated value is a string with a single character. decoder = { code: 'Y', code:'Z', code:'X' } The msg1 variable(s) [there are three in your lab, msg1, msg2, msg3] are lists of lists. Each inner list is a set of code numbers that represent a single character in a string. msg1 = [ [code, code, code, .., code], , [code, code, code .., code] ] Convert the lists of codes to a string [code, code, ., code] Final string decoder Use the dictionary to [code, code, ., code] "String1" "StringN" decode the codes into their associated characters. Example decoder { 80: 'H', 14:'o', 101: 'e', 93:'1'} %3D code list decoded by dictionary -> 'H', 'e', 'l', 'l', 'o' final string "Hello" [ве, 101, 93, 93, 14] Task 2 is to decode all three messages and print them out. In the following, I show the results of decoding messages: msg1, msg2. I'm not showing msg3, so you can find out what it is on your own. Your output needs to have all three strings. You have complete freedom to implement this task in anyway you want as long as the output is correct. You may introduce your own functions. Before printing each message, print the message ID (i.e., 1, 2, or 3) above it as shown below: Task 2 Example for msg1 Message 1 Python is ---- --- msg1 = [[80, 121, 116, 184, 111, 110], [105, 115], [99, 111, 111, 188, 46]] msg1 variable is a list of 3 lists. Each list is decoded with the help of the decoder cool. Message 2 --- dictionary to produce three strings as described above. _(*_*)_ Print each string on its own line to get the final / 0\ (_/ _) Message 3 (message 3 not show) decoded message.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Fundamentals of Input and Output Performance
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education