Question: Copy your Person class from question 5 into a new program. Include in the class the _ _ str _ _ method you added when

Copy your Person class from question 5 into a new program. Include in the class the __str__ method you added when carrying out the exercise in the info panel before question 10.
Add after the class a function read_people(csv_filename) that takes as a parameter the name of a CSV file of person data and returns a list of Person objects, one for each line in the input file (and in the same order). The function should only require 7-10 lines, excluding comments and blank lines. The maximum function length is set to 10 statements for this question; if you find yourself using more than that, please ask a tutor for help.
The input CSV file will contain 4 columns:
a name (not containing a comma)
an integer age (in years)
a float weight (in kg)
a float height (in metres)
For example, the file people1.csv used in the example below contains the following:
Peter Piper,23,89.4,1.82
Polly Perkins,47,148.8,1.67
Griselda Gribble,92,48,1.45
Ivan Ng,19,59,2.0
Lucy Lovelorn,14,50,1.6
Leslie McWhatsit,70,59.2,1.65
You may assume the given file exists and is in the correct format - you're not expected to handle any errors.
Paste your complete Person class definition plus your read_people function but do not include any test code.

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 Programming Questions!