class Trip(object):
'a class that abstracts a trip to a destination'
def __init__(self, destination='Nowhere', items=[] ):
'Initialize the Trip class'
self.destination = destination
self.items = items
class DayTrip(Trip):
'a class that abstracts a trip to a destination on a specific day'
def __init__(self, destination='Nowhere', items=[] , day='1/1/2019' ):
'Initialize the Trip class'
self.destination = destination
self.items = items
self.day = day
class ExtendedTrip(Trip):
'a class that abstracts a trip to a destination on between two dates'
def __init__(self, destination='Nowhere', items=[] , day='1/1/2019' ,
endDay = '12/31/2019' ):
'Initialize the ExtendedTrip class'
self.destination = destination
self.items = items
self.day = day
self.endDay = endDay
def luggage(lst):
I want luggage to take all of the items from each class and print a list printed of all thew unique items.
these are some example inputs:
trip1 = Trip('Basement', ['coat','pants','teddy bear'])
trip2 = DayTrip('Springfield',['floss', 'coat','belt'], '2/1/2018')
trip3 = ExtendedTrip('Mars',['shampoo', 'coat','belt'], '4/1/2058')
trip4 = ExtendedTrip()
Each trip is appended to a list and then it will take a set of the list of items which prints this:
{'pants', 'belt', 'toothbrush', 'floss', 'shampoo', 'teddy bear', 'coat'}