-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeck.py
More file actions
27 lines (18 loc) · 689 Bytes
/
Copy pathDeck.py
File metadata and controls
27 lines (18 loc) · 689 Bytes
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
from random import *
import Card
suits=('Hearts','Diamonds','Spades','Clubs')
ranks=('two','three','four','five','six','seven','eight','nine','ten','jack','queen','king','ace')
values={'two':2,'three':3,'four':4,'five':5,'six':6,'seven':7,'eight':8,'nine':9,'ten':10,'jack':'10','queen':10,
'king':10,'ace':11}
class Deck():
def __init__(self):
self.deck = [] # start with an empty list
for suit in suits:
for rank in ranks:
self.deck.append(Card.Card(rank, suit))
def __str__(self):
return str(self.deck)
def shuffle(self):
shuffle(self.deck)
def popacard(self):
return self.deck.pop()