3. lookup_friends_heights This function takes a friends database (a list of dictionaries, like the previous functions) and a list of friends names, and it returns a list of heights for the specified friends. If a given friend's name is not present in the friends database, we put a None in the corresponding slot. We assume that there will be at most one friend with a given name in the list. You may want to use nested for-loops for this function. Sample calls should look like this. >>> lookup_friends_heights([{"name":"todd", "height":170},{"name":"sarah", "height":165},{"name":"dweezil", "height":175}], ["dweezil", "sarah"]) [175, 165] >>> lookup_friends heights([{"name":"todd", "height" :170},{"name":"sarah", "height":165},{"name": "dweezil","height":175}], ["sarah", "eliza", "dweezil"]) [165, None, 175]

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section13.5: Dynamic Data Structure Allocation
Problem 3E
icon
Related questions
Question
3. lookup_friends_heights
This function takes a friends database (a list of dictionaries, like the previous functions) and a list of friends names, and
it returns a list of heights for the specified friends. If a given friend's name is not present in the friends database, we put
a None in the corresponding slot. We assume that there will be at most one friend with a given name in the list. You
may want to use nested for-loops for this function.
Sample calls should look like this.
>>> lookup_friends_heights([{"name":"todd","height":170},{"name": "sarah", "height":165},{"name":"dweezil", "height":175}],
["dweezil", "sarah"])
[175, 165]
>>> lookup_friends_heights([{"name": "todd","height":170},{"name": "sarah","height":165},{"name": "dweezil", "height":175}],
%3D
["sarah", "elíza", "dweezil"])
[165, None, 175]
Transcribed Image Text:3. lookup_friends_heights This function takes a friends database (a list of dictionaries, like the previous functions) and a list of friends names, and it returns a list of heights for the specified friends. If a given friend's name is not present in the friends database, we put a None in the corresponding slot. We assume that there will be at most one friend with a given name in the list. You may want to use nested for-loops for this function. Sample calls should look like this. >>> lookup_friends_heights([{"name":"todd","height":170},{"name": "sarah", "height":165},{"name":"dweezil", "height":175}], ["dweezil", "sarah"]) [175, 165] >>> lookup_friends_heights([{"name": "todd","height":170},{"name": "sarah","height":165},{"name": "dweezil", "height":175}], %3D ["sarah", "elíza", "dweezil"]) [165, None, 175]
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Types of trees
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage