added repr

This commit is contained in:
2026-04-01 11:54:16 -04:00
parent e613278fa2
commit f0dda78b43

View File

@@ -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.