Question: Using Python 3 programming: Create a class Tour with a single instance variable self.MyList that will refer to a list object. Create a constructor that
Using Python 3 programming:
Create a class Tour with a single instance variable self.MyList that will refer to a list object. Create a constructor that takes one string parameter, the name of a le, filename. This class deals with les representing sets of cities. You will nd on the course website some data les tourX.csv, where X is the number of cities in the set. If you open such a le with a text editor, you will see that the le states one city per row: name, x coordinate, y coordinate.
The constructor must assign the instance variable self.MyList using the le whose name is given as argument (string parameter filename, assumed to be one of the les tourX.csv). When called, the argument is directly a le name, not a path. The constructor assigns to self.MyList a list of the following form (the above text is just an example used to show the expected format):
[['Atlanta', '22', '3'], ['Augusta', '46', '28'], : : :]
Note: in such a list [['Atlanta', '22', '3'], ['Augusta', '46', '28'], : : :], all elements in sublists are strings (not integers).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
