Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add vehicles and compute average year Instructions Purpose of this assignment: Add some additional vehicles to the vehicle inventory and compute the average model

Add vehicles and compute average year

Instructions  

Purpose of this assignment: Add some additional vehicles to the vehicle inventory and compute the average model year: include all of the vehicles in the average, both the ones read from the file and the additional ones added.

For your convenience, find also attached, "cars.csv", which you must read into a dictionary (your code from the previous assignment (Input from CSV file, Dictionary practice) accomplishes this task).

NOTE: Attached is the code files to get you started on this assignment. Use the dropbox link to download the files since it can't be uploaded on here.

What to submit:

Format: A Python .py file (the last 3 characters of the file name should be ".py"). It is not acceptable to submit your code as a screenshot or in a Microsoft Word file.

Content: Your code from the previous assignment (Input from CSV file, Dictionary practice) that I posted and attached here (or modify the other code named readfile.py attached here), along with your changes (the changes are the main part of the work, if you submit code without the changes, it is useless.  Your changes must perform the following tasks:

Task 1: Use the CSV library to copy all the vehicles from the reader into a Dictionary.

Task 2: Add the 3 vehicles here at the end of these instructions into the same dictionary from Task #1.

Task 3: Print the average of the model_year values.  Do not hardcode the model years from the csv file into your code.

model_year: 2001
type: Car
make: MINI
model: S
transmission: 6-speed
primary_color: Red

model_year: 2020
type: Motorcycle
make: Yamaha
model: R6
transmission: 6-speed
primary_color: black
 

model_year: 2020
type: SUV
make: Chevrolet
model: Suburban
transmission: Automatic
primary_color: Grey

 

             

Necessary resources for assignment: (Download from dropbox link below)

                                        

  •    Input from CSV file Dictionary practice.py   https://www.dropbox.com/scl/fi/7tvwbhgquhj6dtbqn2nx8/Input-from-CSV-file-Dictionary-practice.py?rlkey=8wvngyhxu2a7qsxuqvsbuaf0a&dl=0                                                        
  •    readfile.py       https://www.dropbox.com/scl/fi/uo95yofd07mpcomrjlknn/readfile.py?rlkey=tjm6dmbwh6x13rnwdrfhrak6u&dl=0                                             
  •    cars.csv       https://www.dropbox.com/scl/fi/gwjuqgx8g4l4azb4xuhy8/cars.csv?rlkey=6ipvrj1dtis0nhvdomwyka530&dl=0                                                            

*Note as mentioned, you can use either the Input from CSV file dictionary practice.py which was the previous code from last assignment to work with and modify or you can use the readfile.py to work with and modify. It doesn't matter which one. Between which either one you choose to use for the code modification, you will need to also download the cars.csv file.

Step by Step Solution

3.47 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

import csv Define additional vehicles to add additionalvehicles modelyear 2001 type Car make MINI mo... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions