Skip to content
Snippets Groups Projects
Commit 9ee2b27a authored by Louis Chmielewski's avatar Louis Chmielewski
Browse files

__str__ class Card

parent 9fbfd295
No related branches found
No related tags found
No related merge requests found
...@@ -72,6 +72,15 @@ class Card(object): ...@@ -72,6 +72,15 @@ class Card(object):
""" """
return f"Card(\"{self.value}\", \"{self.color}\")" 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: def compare(self, card: Card) -> int:
""" """
compares cards. compares cards.
...@@ -124,6 +133,8 @@ class Card(object): ...@@ -124,6 +133,8 @@ class Card(object):
len(cartes) len(cartes)
""" """
... ...
def __eq__(self, card: Card) -> bool: def __eq__(self, card: Card) -> bool:
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment