Question 1: 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

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

Question 1:
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
Transcribed Image Text:Question 1: 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
Similar questions
  • SEE MORE QUESTIONS
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