diff --git a/Tp08/card.py b/Tp08/card.py index df725a85a9971c1638a2d429f1c604e902e10f0c..b0e103d9351768d7cb8fa27cf7cec1943c5a7cbf 100755 --- a/Tp08/card.py +++ b/Tp08/card.py @@ -72,6 +72,15 @@ class Card(object): """ return f"Card(\"{self.value}\", \"{self.color}\")" + def __str__(self) -> str: + """ + return a string representation of the card + + $$$ str(Card('Ace', 'heart')) + "Ace of heart" + """ + return f"{self.value} of {self.color}" + def compare(self, card: Card) -> int: """ compares cards. @@ -124,6 +133,8 @@ class Card(object): len(cartes) """ ... + + def __eq__(self, card: Card) -> bool: """