Python Langauge
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
100%
Python Langauge

Transcribed Image Text:To help increase memorability, business owners sometimes encode their
phone numbers as mnemonic phrases, known as phonewords. These are
alphanumeric equivalents of a phone number, which can be derived by
using the mapping of letters on the digits of a telephone keypad. Many
popular phone keypads have letters and numbers that look similar to the
figure on the right. With this mapping, we can make the following conver-
sion, for example:
АВС
DEF
123
3
GHI
JKL
MNO
4 5
6
PQRS
TUV
WXYZ
7
8
• FLOWERS translates into 3569377;
• PrOGrAM translates into 7764726; and
• Battery translates into 2288379.
*
Your Task: You will implement a function
Image from code golf
phoneWord2Num(word: str) -> int
that takes as input a string of length exactly 7, where each position is an
upper- or lower- case letter in the English alphabet. The function must
return an integer (of type int) representing the phone number that is the
equivalent of the input string. As an example, we would call phoneWord2Num("Pr0GrAM") and expect
the integer 7764726 as the return value.
TIPS: You may wish to write a new function (generally known as a helper function because its role is
to help complete the main task at hand) that takes in one letter and returns a number corresponding
to that letter.
To implement such a helper function, you may find comfort in knowing that if letter is a single char-
acter and pattern is a string, the expression letter in pattern returns True or False indicating
whether the letter belongs in that pattern. This means:
q1
'a' in 'pxrt' # q1 wil1 be False
'x' in 'pxrt' # q2_will be True
q2
RESTRICTIONS: You can only used Python features we have covered in this class so far. Remember
that we haven't done iterations (for-, while- loops) or lists.
#3
Expert Solution

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 5 steps with 3 images

Recommended textbooks for you

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…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

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…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

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)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY