Question: class DmvRecord: def __init__(self, license_num, maker, model, year, owner_id, reg_exp_date): self.license_num = license_num self.maker = maker self.model = model self.year = year self.owner_id = owner_id

class DmvRecord: def __init__(self, license_num, maker, model, year, owner_id, reg_exp_date): self.license_num = license_num self.maker = maker self.model = model self.year = year self.owner_id = owner_id self.reg_exp_date = reg_exp_date def __str__(self): return "License Number is {} is a {} {} {} owned by {} expires on {}".format(self.license_num, self.maker,self.model, self.year,self.owner_id, self.reg_exp_date) car_list = [] car_list.append(DmvRecord("JK34MA", "Nissan", "Rouge", 2013, "48769", "20210425")) car_list.append(DmvRecord("87H7YT", "Toyota", "Tacoma", 2020, "12546", "20220918")) car_list.append(DmvRecord("SKW98P", "Ford", "Ranger", 2009, "98742", "20211230")) import csv with open('dmv_record.csv', 'w', newline='') as csvfile: emp_writer = csv.writer(csvfile, delimiter=",", quoting=csv.QUOTE_MINIMAL) emp_writer.writerow(['License', 'Make', 'Model', 'Year', 'Owner_ID', 'Reg_exp_Date']) for car in car_list: emp_writer.writerow([car.license_num, car.maker, car.model, car.year, car.owner_id, car.reg_exp_date]) with open('dmv_record.csv', 'r', newline='') as csvfile: emp_reader = csv.reader(csvfile, delimiter=",", quotechar="'") for row in emp_reader: print(row) I need for this code to run both a return statement - i.e, "License Num JK34MA is a 2013 Nissan Rouge owned by 48769 expires on 20210425" and a csv file: 
['License', 'Make', 'Model', 'Year', 'Owner_ID', 'Reg_exp_Date'] ['JK34MA', 'Nissan', 'Rouge', '2013', '48769', '20210425'] ['87H7YT', 'Toyota', 'Tacoma', '2020', '12546', '20220918'] ['SKW98P', 'Ford', 'Ranger', '2009', '98742', '20211230']

This is the exact wording from my assignment:

It also should include a __str__ method that returns a string representation of an instance of the

class, for example "License Num DEF456 is a 2001 Honda Civic owned by AB4242 expires on 20200203".

Add some code to create a list of a few DmvCarRecords.

Add some code to save the list to a CSV file.

Submit your code and CSV file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!