Suppose you are given a list of contacts as input. Your task is to create a “Phonebook” out of those contacts based on their telecom operator. The phonebook is nothing but a nested dictionary which is made of 1 rule: 1.You have to save each contact based on their telecom operator. If there is no contact of a specific telecom operator, that operator should not be shown in the phone book. If a contact number, Starts with ‘017’ or ‘013’ then the telecom operator is Grameenphone Starts with ‘018’ then the telecom operator is Robi Starts with ‘016’ then the telecom operator is Airtel Starts with anything else then the telecom operator is Others While printing the phonebook as output the contacts under each telecom operator should be shown in alphabetically sorted order based on the contact names. See the sample output for clarification. [N.B: The telecom operator names can appear in any order but the contacts under each telecom operator should appear in alphabetical order.] Sample Input: Bob 01632342392 Alice 01346734123 Britney 01803544535 Aeron 01723454642 Smith 01923457890 Tarek 01866392233 Sample Output:(No need to follow this output format. Just print the resultant sorted dictionary. ) { Airtel: { Bob:01632342392 } Grameenphone: { Aeron:01723454642 Alice:01346734123 } Robi: { Britney:01803544535 Tarek:01866392233 } Others: { Smith:01923457890 } }

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...
icon
Related questions
Question

Suppose you are given a list of contacts as input. Your task is to create a “Phonebook” out of those contacts based on their telecom operator. The phonebook is nothing but a nested dictionary which is made of 1 rule:

1.You have to save each contact based on their telecom operator. If there is no contact of a specific telecom operator, that operator should not be shown in the phone book. If a contact number,
Starts with ‘017’ or ‘013’ then the telecom operator is Grameenphone
Starts with ‘018’ then the telecom operator is Robi
Starts with ‘016’ then the telecom operator is Airtel
Starts with anything else then the telecom operator is Others
While printing the phonebook as output the contacts under each telecom operator should be shown in alphabetically sorted order based on the contact names. See the sample output for clarification.
[N.B: The telecom operator names can appear in any order but the contacts under each telecom operator should appear in alphabetical order.]

Sample Input:
Bob 01632342392 Alice 01346734123 Britney 01803544535 Aeron 01723454642 Smith 01923457890 Tarek 01866392233

Sample Output:(No need to follow this output format. Just print the resultant sorted dictionary. )
{
Airtel:
{
Bob:01632342392
}
Grameenphone:
{
Aeron:01723454642
Alice:01346734123
}
Robi:
{
Britney:01803544535
Tarek:01866392233
}
Others:
{
Smith:01923457890
}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY