subject

Make a backwards phonebook from a regular phonebook

your function should take 2 parameters: infile and outfile

infile should be a phonebook in the same format as question 2 (version 2).

outfile should be a list of phone number people pairs, sorted by phone number

as with question 2, you should account for the possibility that 2 people may share a single phone number (e. g., a land line if they live in the same home)

first read in all phone numbers into a dictionary, the same as you had done for question 2. you can call functions defined in question 2 and use global variables from question 2 as well if it makes sense to do so.

read through that dictionary and create a backwards version.

in the new dictionary the keys are phone numbers and the values are lists of people

use a similar strategy as with version 2 of question 2:

if a number is not in the dictionary, you create a new entry which is a list of a single person

otherwise, you check the list associated with that number and you add a person's name if they are not already listed in the (backwards) phonebook

create a list of keys from the dictionary and sort it.

for each key in the list, look up the corresponding entry/

for each name in the entry (also a list), write a line in the output firle consisting of a telephone number + a tab + a name

for example, given the sample file

name phone number
bob 212-888-
bugs 917-433-
daffy 914-400-4141
daffy 800-999-
daisy 914-400-4141
daisy 123-456-7890
pippi 301-999-9990
pippi 800-333-4400
yosemite 212-333-
as input, the program would produce

telephone number name
123-456-7890 daisy
212-333- yosemite
212-888- bob
301-999-9990 pippi
800-333-4400 pippi
800-999- daffy
914-400-4141 daisy
914-400-4141 daffy
917-433- bugs
as output (notice that daffy and daisy share a phone number).

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
Quick pl which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 07:50
Apython programming question: assume s is a string of lower case characters. write a program that prints the number of times the string 'bob' occurs in s. for example, if s = 'azcbobobegghakl', then your program should print number of times bob occurs is: 2
Answers: 3
question
Computers and Technology, 23.06.2019 09:10
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
You know the right answer?
Make a backwards phonebook from a regular phonebook

your function should take 2 paramete...
Questions
question
Mathematics, 15.09.2019 23:10
question
Mathematics, 15.09.2019 23:10
question
Social Studies, 15.09.2019 23:10
question
Mathematics, 15.09.2019 23:10
Questions on the website: 13722362