Apply today's Project 1 changes to Project 2

This commit is contained in:
2026-02-10 19:25:34 -05:00
parent 907b063a2c
commit 61188d673f
2 changed files with 41 additions and 1 deletions

View File

@@ -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".
#Returns a string representation of the card in the format "Value of Suit".
def __add__(self, other) -> int:
#Adding 2 cards together
if isinstance(other, Card):
return self.value + other.value
elif isinstance(other, int):
#allows adding a card to an int
return self.value + other
#Added for project 2: Created an "__add__" meathod to allow adding Cards together.