...

/

Untitled Masterpiece

Test yourself on the collections module with Python.

Quiz

1.

Given the code below, which of the following is the correct way to access the price of seat_cover?

from collections import ChainMap

car_parts = {"hood": 500, "engine": 5000, "front_door": 750}
car_options = {"A/C": 1000, "Turbo": 2500, "rollbar": 300}
car_accessories = {"cover": 100, "hood_ornament": 150, "seat_cover": 99}
car_pricing = ChainMap(car_accessories, car_options, car_parts)

A.

print (car_pricing['seat_cover'])

B.

print (car_pricing.get['seat_cover'])

C.

print (car_pricing.car_accessories['seat_cover'])

D.

print (['seat_cover'])


1 / 8