Computers and Technology

1 #Write a function called phonebook that takes two lists as 2 #input:
3 #
4 # - names, a list of names as strings
5 # - numbers, a list of phone numbers as strings
6 #
7 #phonebook() should take these two lists and create a
8 #dictionary that maps each name to its phone number. For
9 #example, the first name in names should become a key in
10 #the dictionary, and the first number in numbers should
11 #become the value corresponding to the first name. Then, it
12 #should return the dictionary that results.
13 #
14 #Hint: Because you're mapping the first name with the first
15 #number, the second name with the second number, etc., you do
16#not need two loops. For a similar exercise, check back on
17 #Coding Problem 4.3.3, the Scantron grading problem.
18 #
19 #You may assume that the two lists have the same number of #items: there will be no names without numbers or numbers
20 #without names.
21 #Write your function here!
25
26
27
28 #Below are some lines of code that will test your function
29 #You can change the value of the variable(s) to test your
30 #function wit h different inputs 2 If your function works correctly, this ill originally
31
32 #print (although the order of the keys may vary):
33| #('Jackie': '404-555-1234., 'Joshua': .678-555-5678., "Marguerite': '778-555-9012
35
36 name_list ['Jackie', Joshua', 'Marguerite']
37 number list-['484-555-1234, 678-555-5678 770-555-9812']
38 print (phonebook (name list, numberlist))
39
40
41

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 07:50, madim1275
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle was in the shop and closed out by the office. this time is referred to as _ time ? a. comeback b. ro c. cycle d. lead
Answers: 1
image
Computers and Technology, 24.06.2019 01:00, cheycheybabygirl01
How can the temperature of a room be raised by 5degreesf?
Answers: 1
image
Computers and Technology, 24.06.2019 10:10, juliana0122
Scanning the road can be thought of as a
Answers: 2
image
Computers and Technology, 24.06.2019 13:20, ana9340
3. ranga ramasesh is the operations manager for a firm that is trying to decide which one of four countries it should research for possible outsourcing providers. the first step is to select a country based on cultural risk factors, which are critical to eventual business success with the provider. ranga has reviewed outsourcing provider directories and found that the four countries in the table that follows have an ample number of providers from which they can choose. to aid in the country selection step, he has enlisted the aid of a cultural expert, john wang, who has provided ratings of the various criteria in the table. the resulting ratings are on a 1 to 10 scale, where 1 is a low risk and 10 is a high risk. john has also determined six criteria weightins: trust, with a weight of 0.3; quality, with 0.2; religious, with 0.1; individualism, with 0.2; time, with 0.1; and uncertainity, with 0.1. using the factor-rating method, which country should ranga select? why? (2 points)
Answers: 3
Do you know the correct answer?
1 #Write a function called phonebook that takes two lists as 2 #input:
3 #
4 # - name...

Questions in other subjects: