Added comments to Card.py
This commit is contained in:
@@ -1,14 +1,22 @@
|
|||||||
class Card:
|
class Card:
|
||||||
|
"""
|
||||||
|
Represents a playing card with a suit and value.
|
||||||
|
"""
|
||||||
def __init__(self, suit: str, value: str):
|
def __init__(self, suit: str, value: str):
|
||||||
self._suit = suit
|
self._suit = suit
|
||||||
self._value = value
|
self._value = value
|
||||||
|
#Creates a Card object with the specified suit and value.
|
||||||
|
|
||||||
def get_suit(self) -> str:
|
def get_suit(self) -> str:
|
||||||
return self._suit
|
return self._suit
|
||||||
|
|
||||||
|
#Returns the suit of the card.
|
||||||
|
|
||||||
def get_value(self) -> str:
|
def get_value(self) -> str:
|
||||||
return self._value
|
return self._value
|
||||||
|
#Returns the value of the card.
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"{self._value} of {self._suit}"
|
return f"{self._value} of {self._suit}"
|
||||||
|
|
||||||
|
#Returns a string representation of the card in the format "Value of Suit".
|
||||||
Binary file not shown.
Reference in New Issue
Block a user