Write a function named create_names_dictionary (initials_list, names_list) which takes a list of initials and a list of

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a function named create_names_dictionary (initials_list, names_list) which takes a list of initials and a list of

Post by answerhappygod »

Write A Function Named Create Names Dictionary Initials List Names List Which Takes A List Of Initials And A List Of 1
Write A Function Named Create Names Dictionary Initials List Names List Which Takes A List Of Initials And A List Of 1 (35.04 KiB) Viewed 13 times
Write a function named create_names_dictionary (initials_list, names_list) which takes a list of initials and a list of names as parameters. The function returns a dictionary by looping through each element in the first and the second list and creating a corresponding key:value item. The 'key' of each item in the dictionary is the initials of the first name and surname, and the 'value' is the name (e.g. key of 'AW", value of 'Alex Wong'). For example, the following code: names_list = ['Abby Anderson', 'Bella Campbell'] initials ['AA', 'BC'] my_dictionary = create_names_dictionary (initials, names_list) print(my_dictionary) produces {'AA': 'Abby Anderson', 'BC': 'Bella Campbell'} You can assume that both parameters are the same length and that the initials_list does not contain any duplicates. For example: Test Result names_list = ['Abby Anderson', 'Bella Campbell', 'Charlotte Donovan'] AA Abby Anderson initials = ['AA', 'BC', 'CD'] BC Bella Campbell my_dictionary = create_names_dictionary (initials, names_list) CD Charlotte Donovan for letter in sorted (my_dictionary.keys()): print(letter, my_dictionary [letter])
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply