Answer:
The writting code will be for =>
(1). item.py.
(2). code.py.
(3). test.py.
Explanation:
NB: kindly download the doc. attachment below for the code for (2). code.py and (3). test.py.
So, we will be writting a working code for the three files and they are; item.py, code.py and test.py.
(1). Item.py.
class Item(object):
def __init__(self, name: str, weight: int, value: int) -> None:
self.name = name
self.weight = weight
self.value = value
def __lt__(self, other: "Item"):
if self.value == other.value:
if self.weight == other.weight:
return self.name < other.name
else:
return self.weight < other.weight
else:
return self.value < other.value
def __eq__(self, other: "Item") -> bool:
if isinstance(other, Item):
return (self.name == other.name and
self.value == other.value and
self.weight == other.weight)
else:
return False
def __ne__(self, other: "Item") -> bool:
return not (self == other)
def __str__(self) -> str:
return f'A {self.name} worth {self.value} that weighs {self.weight}'