class Cargo: def __init__(self, name, category, size, weight): self.name = name self.size = size self.weight = weight self.category = category class Clothes(Cargo): def __init__(self, name, size, weight, fragility): super().__init__(name,"clothes", size, weight) self.fragility = fragility class NuclearWaste(Cargo): def __init__(self, name, size, weight, exp_date, toxicity): super().__init__(name,"nuclear_waste" ,size, weight) self.exp_date = exp_date self.toxicity = toxicity class Fruit(Cargo): def __init__(self, name ,size, weight, exp_date): super().__init__(name,"fruit" ,size, weight) self.exp_date = exp_date class Carparts(Cargo): def __init__(self, name ,size, weight): super().__init__(name,"car_parts" ,size, weight) class Forklift: def __init__(self, model): self.model = model class Shelf: def __init__(self, category): self.category = category self.items = [] def add_item(self, item): if isinstance(item, Cargo) and item.category == self.category: self.items.append(item) else: print(f"Can't add: {item.name}. Shelf is for: {self.category}")