Computers and Technology, 26.12.2019 02:31 kayltosh2729
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).
Answers: 1
Computers and Technology, 22.06.2019 15:30
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
Computers and Technology, 22.06.2019 21:30
The graph shows median weekly earnings for full-time workers according to education level. which can you not conclude?
Answers: 2
Computers and Technology, 23.06.2019 16:30
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
Computers and Technology, 23.06.2019 18:00
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
Make a backwards phonebook from a regular phonebook
your function should take 2 paramete...
your function should take 2 paramete...
Mathematics, 11.01.2021 08:50
Mathematics, 11.01.2021 08:50
English, 11.01.2021 08:50
French, 11.01.2021 08:50
Mathematics, 11.01.2021 08:50
Mathematics, 11.01.2021 08:50