A class may have a property that is list and contains class instances.
Example
Output:
Explanation:
line 12 an empty list is created.lines 32 - 34 elements are added to the list.line 16 the list is sorted ascending by price.
If we replace line 16 with
self.cars.sort(key=lambda x: x.price, reverse=True),
then the sorting would be descending.