-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathblack_jack.py
22 lines (22 loc) · 1 KB
/
black_jack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Create a Card class, that has a color and a value
# Create a constructor for setting those values
# Card should be represented as string in this format:
# 9 Hearts
# Jack Diamonds
# Create a Deck class, that has a list of cards in it
# Create a constructor that takes a whole number as parameter
# The constructor should fill the list with the number of different cards using at least 4 different colors (except if the number given is smaller than four, than all cards should have different colors)
# We should be able to shuffle the deck, which randomly orders the cards
# We should be able to draw the top card which returns the drawn card and also removes it from the deck
# Deck should be represented as string in this format:
# 12 cards - 3 Clubs, 3 Diamonds, 3 Hearts, 3 Spades
deck = Deck(12)
print(deck)
# Should print out:
# 12 cards - 3 Clubs, 3 Diamonds, 3 Hearts, 3 Spades
top_card = deck.draw()
print(top_card)
print(deck)
# Should print out:
# Queen Spades
# 11 cards - 3 Clubs, 3 Diamonds, 3 Hearts, 2 Spades