Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NSID: 5 1 . In this question, you'll be evaluated on your ability to apply your knowledge of loops, lists, and dictionaries. Acme Corporation collects

NSID:
51. In this question, you'll be evaluated on your ability to apply your knowledge of loops, lists, and dictionaries.
Acme Corporation collects data about their company trucks:
\table[[Location,Trucks,Need Repairs,City],[JPV Building,5,0,Saskatoon],[Stock Yard A,3,2,Regina],[Warehouse 42,7,1,Prince Albert]]
Assume the data is being stored in a list named trucks, and that each element in the list is a record (i.e. a dictionary) with keys 'location', 'trucks', 'repairs', 'city' each associated with their respective columns in the above table. In other words, each row in the above table is a dictionary record, and the whole table is a list of those records.
(2)
(a) A new truck has been added to the fleet and is being added to Warehouse 42 location. This means that the number of trucks has increased by 1. Write Python code that will update the list of records to reflect this change. You cannot assume that the locations were added to the list-of records in the order shown in the table above, nor can you assume that there are only 3 location records in the list.
(2)
(b) Write a list comprehension to produce a list of JUST the location names that have more than 0 trucks that need repairs. Again, you cannot assume the locations shown above are the only ones in the list.
Note: Solutions that do not use a list comprehension will receive zero marks.
image text in transcribed

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

Describe the Toyota method for problem solving.

Answered: 1 week ago

Question

Identify steps of laser printing Identify steps of laser printing

Answered: 1 week ago

Question

=+1. How can you animate it?

Answered: 1 week ago