Question
Python question: Suppose you have a dictionary of dictionaries, or a 2D dictionary, called banditos as follows: alonzo = {age: 10, height: 42, weight: 175,
Python question:
Suppose you have a dictionary of dictionaries, or a 2D dictionary, called banditos as follows: alonzo = {"age": 10, "height": 42, "weight": 175, "instrument":"fiddle" }
turing = {"age": 41, "height": 70, "weight": 160, "instrument": "theremin"}
bertha = {"age": 32, "height": 97, "weight": 587, "instrument": "cello"}
tinkerB = {"age":100, "height": 4, "weight": 0.5, "instrument": "cello"}
banditos = {"Alonzo": alonzo, "Turing": turing, "Bertha": bertha, "TinkerB": tinkerB}
We can access the sub-dictionary, or vector, of Alonzo's attributes as follows: banditos["Alonzo"] {"age": 10, "height": 42, "weight": 175, "instrument ": "fiddle" }
We can also return a specific feature of Alonzo's as: banditos["Alonzo"]["age"] 10
For the above dictionary, banditos, write a function that, when given the dictionary, returns a list of users who play a certain instrument. E.g., here's a sample run and its result: find_players(banditos, "cello") ["Bertha", "TinkerB"]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started