1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lynna [10]
4 years ago
15

Make a Backwards Phonebook from a Regular Phonebook

Computers and Technology
1 answer:
Dima020 [189]4 years ago
7 0

Answer:

Code in Python is given. Take note of the instruction in bold font

Explanation:

You will need to update the below two lines in your system based on the file path -

backward_phone_number('F:\\phone_number_input.txt','F:\\phone_number_output.txt')

def backward_phone_number(input_file,output_file):

   ph_num_dictionary={}

   entries=[]

   #########################################################

   with open(input_file,'r') as read_file:

       entries=read_file.readlines()[1:]

   for entry in entries:

       ph_num_name=entry.split()

       ph_number=ph_num_name[1].strip()

       name=ph_num_name[0].strip()

       if ph_num_dictionary.get(ph_number)==None:

           name_list=[name]

           ph_num_dictionary[ph_number]=name_list

       else:

           ph_num_dictionary.get(ph_number).append(name)

   #########################################################

   ph_num_dictionary = dict(sorted(ph_num_dictionary.items(),key=lambda pair:pair[0]))

   with open(output_file,'w+') as write_file:

       write_file.write('Telephone Number\tName\r\n')

       for num,name in ph_num_dictionary.items():

           if len(name)==1:

               write_file.write(num+'\t'+name[0]+'\r\n')

           else:

               name.sort()

               for person in name:

                   write_file.write(num + '\t' + person + '\r\n')

backward_phone_number('F:\\phone_number_input.txt','F:\\phone_number_output.txt')

You might be interested in
Your essay is due tomorrow and you don't have time to write it. You decide to buy an essay online. You've paid for it, so it can
viva [34]

Answer:

false

even though you have paid for it , you still didn't write it by yourself, there for it will still be seen as plagiarism.......hope this helps

4 0
3 years ago
Practising some questions for board exams for class 12 python,pls help with detailed answer
poizon [28]
I do t know the answer to this but i think tou can firger it iut food luck
3 0
3 years ago
What unit is used to describe the smallest amount of bitcoin?
diamong [38]

Answer:

The satoshi is currently the smallest unit of the bitcoin currency recorded on the block chain. It is a one hundred millionth of a single bitcoin (0.00000001 BTC).

Explanation:

A bitcoin is a type of digital currency in which a record of transactions is kept and new units of currency are generated by the computational solution of mathematical problems. Bitcoins operate independently through a central bank.

7 0
3 years ago
Write a JavaScript program to generate the following pattern but the number of rows should be user input.
Nookie1986 [14]

Answer:

Testicles

Explanation:

u sukkk

3 0
3 years ago
What are the risks associated with this kind of connectivity?.
Eva8 [605]

Answer:

The risks associated with this kind of connectivity are that online hackers may see your information and that makes the human race too dependent on robots and technology which is never a good thing.

Explanation:

<h3>be happy</h3>
8 0
3 years ago
Other questions:
  • When did Kodak introduce film photography to the commercial market?
    10·2 answers
  • Both the USB flash drive and the DVD are data storage devices, but they both have numerous differences. Both can contain insane
    6·1 answer
  • Holly Carpenter argues that technology may actually prevent some kinds of evolution that would benefit humans. Do you agree with
    8·2 answers
  • Because Microsoft Access includes not only the software needed to create a database, but also the software needed to create form
    7·1 answer
  • Which of the following statements is true regarding the e-mails that were collected from Marina and Rita's Cupcakes' key employe
    11·1 answer
  • Within a major students can choose to study a specific area within major. For example a journalism student may study military jo
    8·1 answer
  • Heidi uses her computer to write articles for a newspaper. She uses a program to listen to the articles before she submits them
    5·1 answer
  • Can someone help me i need to write something for cyber bullying
    11·2 answers
  • how risk can impact each of the seven domains of a typical IT infrastructure: User, Workstation, Local Area Network (LAN), Local
    7·1 answer
  • ________ take advantage of vulnerabilities in software. Group of answer choices Blended threats Bots Trojan horses Direct-propag
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!