diff --git a/Project 1/Card.py b/Project 1/Card.py index 307c5af..409d51a 100644 --- a/Project 1/Card.py +++ b/Project 1/Card.py @@ -19,4 +19,13 @@ class Card: def __repr__(self) -> str: return f"{self._value} of {self._suit}" - #Returns a string representation of the card in the format "Value of Suit". \ No newline at end of file + #Returns a string representation of the card in the format "Value of Suit". + + def __add__(self, other) -> int: + if isinstance(other, Card): + return self.value + other.value + elif isinstance(other, int): + return self.value + other + else: + return NotImplemented + #Added for project 2: Created an "__add__" meathod to allow adding Cards together.