added comments to Card.py
This commit is contained in:
@@ -22,10 +22,10 @@ class Card:
|
|||||||
#Returns a string representation of the card in the format "Value of Suit".
|
#Returns a string representation of the card in the format "Value of Suit".
|
||||||
|
|
||||||
def __add__(self, other) -> int:
|
def __add__(self, other) -> int:
|
||||||
|
#Adding 2 cards together
|
||||||
if isinstance(other, Card):
|
if isinstance(other, Card):
|
||||||
return self.value + other.value
|
return self.value + other.value
|
||||||
elif isinstance(other, int):
|
elif isinstance(other, int):
|
||||||
|
#allows adding a card to an int
|
||||||
return self.value + other
|
return self.value + other
|
||||||
else:
|
|
||||||
return NotImplemented
|
|
||||||
#Added for project 2: Created an "__add__" meathod to allow adding Cards together.
|
#Added for project 2: Created an "__add__" meathod to allow adding Cards together.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
"""
|
||||||
|
Reo
|
||||||
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from Card import Card
|
from Card import Card
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user