File tree 1 file changed +1
-22
lines changed
1 file changed +1
-22
lines changed Original file line number Diff line number Diff line change @@ -8,30 +8,9 @@ class Item:
8
8
weight : int
9
9
value : int
10
10
11
- def __eq__ (self , other : object ) -> bool :
12
- """
13
- Compare two Item objects for equality based on weight and value attributes.
14
-
15
- Args:
16
- other (object): Another object to compare with.
17
-
18
- Returns:
19
- 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
29
- """
30
- if not isinstance (other , Item ):
31
- return False # Return False for non-Item objects
11
+ def not_really__eq__ (self , other : object ) -> bool :
32
12
return self .weight == other .weight and self .value == other .value
33
13
34
-
35
14
def fractional_cover (items : list [Item ], capacity : int ) -> float :
36
15
"""
37
16
Solve the Fractional Cover Problem.
You can’t perform that action at this time.
0 commit comments