Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions