-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCard.py
More file actions
44 lines (34 loc) · 1.12 KB
/
Card.py
File metadata and controls
44 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Card:
def __init__(self,suit, inputvalue):
self.suit = suit
self.value = inputvalue
def getValue(self) -> int:
return self.value
def getSuit(self):
return self.suit
def __str__(self):
if(self.suit == 1):
return f"{self.getValue()} of Spades"
elif(self.suit == 2):
return f"{self.getValue()} of Hearts"
elif(self.suit == 3):
return f"{self.getValue()} of Clubs"
elif(self.suit == 4):
return f"{self.getValue()} of Diamonds"
elif(self.suit <= 0):
return f"EMPTY"
else:
return "ERROR IN PRINTING A CARD"
def __repr__(self):
if(self.suit == 1):
return f"{self.getValue()} of Spades"
elif(self.suit == 2):
return f"{self.getValue()} of Hearts"
elif(self.suit == 3):
return f"{self.getValue()} of Clubs"
elif(self.suit == 4):
return f"{self.getValue()} of Diamonds"
elif(self.suit <= 0):
return f"EMPTY"
else:
return "ERROR IN PRINTING A CARD"