Question: (PYHTON)Write a program that makes and modifies a phonebook Create Version 1: We assume that each person is associated with exactly one phone number Your
(PYHTON)Write a program that makes and modifies a phonebook
Create Version 1:
We assume that each person is associated with exactly one phone number
Your program should read in a .tsv file in which each line consists of: a person's name, a tab, and a phone number.
A sample file is provided as simple_phone_book.tsv
(Bugs 212-222-2222 Yosemite 212-333-3333 Daisy 914-400-4141 Daffy 914-400-4141 Pippi 301-999-9990)
Your program should store this information as a dictionary such that the person's name is the key and the telephone number is the value.
Your program should give a user the option of adding additional names and phone numbers to the dictionary
Your program should collect the keys of the dictionary into a list and put them in alphabetical order
Then your program should write the entries into a new .tsv file, in alphabetical order.
For example, define a function: update_phonebook1(infile,outfile)
Run that function with simple_phone_book.tsv as infile and simple_phone_book_output.tsv as outfile.
After adding a few items, this version of simple_phone_book_output.tsv is a possible output file assuming that a few telephone numbers were added (of course the version that you create may be a little different because you may be adding different phone numbers).
Name Phone Number Bilbo 999-999-0101 Daffy 914-400-4141 Daisy 914-400-4141 Hermione 777-4747-7777 Pippi 301-999-9990 Yosemite 212-333-3333
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
