June 2017
Beginner
352 pages
8h 39m
English
Let's return to our Aircraft class:
class Aircraft: def __init__(self, registration, model, num_rows, num_seats_per_row): self._registration = registration self._model = model self._num_rows = num_rows self._num_seats_per_row = num_seats_per_row def registration(self): return self._registration def model(self): return self._model def seating_plan(self): return (range(1, self._num_rows + 1), "ABCDEFGHJK"[:self._num_seats_per_row])
The design of this class is somewhat flawed, in that objects instantiated using it depend on being supplied with a seating configuration that matches the aircraft model. For the purposes of this exercise we can assume that the seating arrangement is fixed per aircraft model.
Better, and simpler, ...
Read now
Unlock full access