In Python please!
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
In Python please!
![# variables for task 2
{80: "P", 121: 'у', 116: 't', 104: "h', 111: 'о', 110: 'n', 105: 'i', 115: 's', 99: "с', 108: '1,
', 44: ',', 45: '-', 95: '_', 40: '(', 42: '*', 41: ')', 47: '/', 92: '\\', 61: '=', 39:
58: ':', 59: ';'}
decoder
46: '.', 32:
124: '|', 96:
...
[[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],
msg1
msg2
[32, 32, 47, 32, 111, 32, 92], [32, 40, 95, 47, 32, 92, 95, 41, 32]]
msg3
32, 32, 32, 95, 95, 46, 46, 45, 45, 45, 46, 46, 95, 95], [32, 44, 45, 61, 39, 32, 32, 47, 32, 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]]
[[32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40], [32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 41], [32, 32,
%3D](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbeb43acd-4bfb-4c49-84a8-7d6db7b72498%2Fb7748adc-5ba6-43f0-ac8a-1ebbeddbf579%2Ff8dhf8_processed.png&w=3840&q=75)
Transcribed Image Text:# variables for task 2
{80: "P", 121: 'у', 116: 't', 104: "h', 111: 'о', 110: 'n', 105: 'i', 115: 's', 99: "с', 108: '1,
', 44: ',', 45: '-', 95: '_', 40: '(', 42: '*', 41: ')', 47: '/', 92: '\\', 61: '=', 39:
58: ':', 59: ';'}
decoder
46: '.', 32:
124: '|', 96:
...
[[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],
msg1
msg2
[32, 32, 47, 32, 111, 32, 92], [32, 40, 95, 47, 32, 92, 95, 41, 32]]
msg3
32, 32, 32, 95, 95, 46, 46, 45, 45, 45, 46, 46, 95, 95], [32, 44, 45, 61, 39, 32, 32, 47, 32, 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]]
[[32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40], [32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 41], [32, 32,
%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
decode the codes into
their associated characters.
"String1"
"StringN"
[code, code, ., code]
Example
decoder = { 8e: 'H', 14: 'o', 101: 'e', 93:'1'}
code list
[8е, 101, 93, 93, 14]
final string
decoded by dictionary
'H', 'e', 'l', 'l', 'o'
->
->
"Hello"
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
msg1 = [[80, 121, 116, 104, 111, 110],
[105, 115], [99, 111, 111, 108, 46]]
is
cool.
msg1 variable is a list of 3 lists.
Message 2
Each list is decoded with the help of the decoder
dictionary to produce three strings as described
above.
_(*_*)_
Print each string on its own line to get the final
decoded message.
(/ L)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbeb43acd-4bfb-4c49-84a8-7d6db7b72498%2Fb7748adc-5ba6-43f0-ac8a-1ebbeddbf579%2F5nk2vfm_processed.png&w=3840&q=75)
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
decode the codes into
their associated characters.
"String1"
"StringN"
[code, code, ., code]
Example
decoder = { 8e: 'H', 14: 'o', 101: 'e', 93:'1'}
code list
[8е, 101, 93, 93, 14]
final string
decoded by dictionary
'H', 'e', 'l', 'l', 'o'
->
->
"Hello"
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
msg1 = [[80, 121, 116, 104, 111, 110],
[105, 115], [99, 111, 111, 108, 46]]
is
cool.
msg1 variable is a list of 3 lists.
Message 2
Each list is decoded with the help of the decoder
dictionary to produce three strings as described
above.
_(*_*)_
Print each string on its own line to get the final
decoded message.
(/ L)
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY