Skip to content

Commit c2ca40b

Browse files
Create 04 Black Jack Advice
1 parent 287703d commit c2ca40b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

1 Python/labs/04 Black Jack Advice

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Lab 4: Blackjack Advice
2+
3+
Let's write a python program to give basic blackjack playing advice during a game by asking the player for cards.
4+
First, ask the user for three playing cards (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K).
5+
Then, figure out the point value of each card individually. Number cards are worth their number, all face cards are worth 10.
6+
At this point, assume aces are worth 1. Use the following rules to determine the advice:
7+
8+
Less than 17, advise to "Hit"
9+
Greater than or equal to 17, but less than 21, advise to "Stay"
10+
Exactly 21, advise "Blackjack!"
11+
Over 21, advise "Already Busted"
12+
13+
Print out the current total point value and the advice.
14+
15+
What's your first card? Q
16+
What's your second card? 2
17+
What's your third card? 3
18+
15 Hit
19+
20+
What's your first card? K
21+
What's your second card? 5
22+
What's your third card? 5
23+
20 Stay
24+
25+
What's your first card? Q
26+
What's your second card? J
27+
What's your third card? A
28+
21 Blackjack!
29+
30+
Version 2 (optional)
31+
32+
Aces can be worth 11 if they won't put the total point value of both cards over 21. Remember that you can have multiple aces in a hand.
33+
Try generating a list of all possible hand values by doubling the number of values in the output whenever you encounter an ace.
34+
For one half, add 1, for the other, add 11. This ensures if you have multiple aces that you account for the full range of possible values.

0 commit comments

Comments
 (0)