From f0dda78b43bb134b8ba9bc255589aa2e620279c1 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 1 Apr 2026 11:54:16 -0400 Subject: [PATCH] added repr --- Project 1/Deck.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Project 1/Deck.py b/Project 1/Deck.py index df0c047..e5a9858 100644 --- a/Project 1/Deck.py +++ b/Project 1/Deck.py @@ -34,6 +34,14 @@ class Deck: def number_of_cards(self) -> int: return len(self._cards) - self._next_card #Returns the number of remaining cards in the deck. + + def __repr__(self) -> str: + """ + Returns a string representation of the entire deck, + with one card per line. + """ + return "\n".join(str(card) for card in self._cards) + if __name__ == "__main__": deck = Deck() deck.shuffle() #Calls the shuffle method to randomize the deck.