Answered step by step
Verified Expert Solution
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:
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:
tableLocationTrucks,Need Repairs,CityJPV Building,SaskatoonStock Yard AReginaWarehouse Prince Albert
Assume the data is being stored in a list named trucks, and that each element in the list is a record ie 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.
a A new truck has been added to the fleet and is being added to Warehouse location. This means that the number of trucks has increased by Write Python code that will update the list of records to reflect this change. You cannot assume that the locations were added to the listof records in the order shown in the table above, nor can you assume that there are only location records in the list.
b Write a list comprehension to produce a list of JUST the location names that have more than 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.
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