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]
3 years ago
15

Make a Backwards Phonebook from a Regular Phonebook

Computers and Technology
1 answer:
Dima020 [189]3 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
What is x squared times b squared
Pie

Answer:

x^2 * b^2

Explanation:

Like 3 squared times 2 squared is 3*3*2*2. Similarly the expression given in the question is equal to x*x*b*b. And that explains what is mentioned in question.

3 0
3 years ago
A_________is a way for students to keep track of information during research.
Fudgin [204]
Note pad your welcome


4 0
3 years ago
A technically qualified individual who may configure firewalls and IDPSs, implement security software, diagnose and troubleshoot
sineoko [7]

Answer:

Security technician

Explanation:

Security technicians are responsible for fixing, planning, and implementing the IT and computer security system of organisations by making sure the safety and security of the data and information of the clients as well as the employees that make daily use of the systems

Security technicians administer security access to the clients and employees of the organization and are responsible for being up to date with the latest IT security technology developments.

7 0
3 years ago
_____ is confirming the significance of what another person is feeling.
il63 [147K]

Validation: Understanding and showing acceptance for another person                

4 0
3 years ago
Read 2 more answers
Which command should you use to display both listening and non-listening sockets on your linux system? (tip: enter the command a
trasher [3.6K]

Answer: netstat -a

Explanation: The netstat -a command displays both listening and non-listening sockets.

3 0
2 years ago
Other questions:
  • Some files appear dimmed in one of the default folders on your computer. What would be the best course of action? A. Leave the f
    5·1 answer
  • Your license can be canceled if you __________
    9·2 answers
  • Which is the primary use of a word processor? create, edit, format, and print text-based documents maintain a database of record
    5·1 answer
  • Blank is a type of drag and drop code to help beginner
    14·1 answer
  • Write a program that will generate 100 integers between 0 and 1000. Store the even numbers in a sorted linked list called evens.
    12·1 answer
  • I NEED HELP ASAP
    8·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    11·1 answer
  • NEED HELP ASAP
    13·2 answers
  • (Just wondering and for fun) What can humanity do to survive after the universe dies? Assuming we have advanced tech and there a
    9·1 answer
  • China's cultural diversity, China is composed of 56 ethnic groups.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!