From 3382b922ab8ea4a780483d8aad49e916164b3270 Mon Sep 17 00:00:00 2001 From: Benjamin Adovasio Date: Tue, 10 Feb 2026 18:39:13 -0500 Subject: [PATCH] Added a method to Card.py --- Project 1/Card.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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.