Final changes to Project 1 and Project 2
This commit is contained in:
@@ -32,8 +32,12 @@ class Card:
|
||||
def __add__(self, other) -> int:
|
||||
#Adding 2 cards together
|
||||
if isinstance(other, Card):
|
||||
return self.value + other.value
|
||||
return self._value + other._value
|
||||
elif isinstance(other, int):
|
||||
#allows adding a card to an int
|
||||
return self.value + other
|
||||
return self._value + other
|
||||
return NotImplemented
|
||||
|
||||
def __radd__(self, other) -> int:
|
||||
return self.__add__(other)
|
||||
#Added for project 2: Created an "__add__" meathod to allow adding Cards together.
|
||||
|
||||
BIN
Project 2/Project 2.pdf
Normal file
BIN
Project 2/Project 2.pdf
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user