Skip to content

Commit 3436d20

Browse files
authored
Update fractional_cover_problem.py
1 parent 64e32b3 commit 3436d20

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

greedy_methods/fractional_cover_problem.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ def __eq__(self, other: "Item") -> bool:
1717
1818
Returns:
1919
bool: True if the objects are equal, False otherwise.
20+
21+
Examples:
22+
>>> item1 = Item(10, 60)
23+
>>> item2 = Item(10, 60)
24+
>>> item3 = Item(20, 100)
25+
>>> item1 == item2
26+
True
27+
>>> item1 == item3
28+
False
2029
"""
2130
return self.weight == other.weight and self.value == other.value
2231

@@ -95,3 +104,4 @@ def fractional_cover(items: list[Item], capacity: int) -> float:
95104
print("All tests passed")
96105
else:
97106
print(f"{result} test(s) failed")
107+

0 commit comments

Comments
 (0)