Skip to content

Commit 29c4988

Browse files
authored
Merge pull request #78 from PdxCodeGuild/jonpan-newlab04-blackjack
resubmitting lab04 on a new branch
2 parents 68abb95 + 9665f5a commit 29c4988

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

code/jonpan/lab04.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
cards = {
2+
"A": 1,
3+
"2": 2,
4+
"3": 3,
5+
"4": 4,
6+
"5": 5,
7+
"6": 6,
8+
"7": 7,
9+
"8": 8,
10+
"9": 9,
11+
"10": 10,
12+
"J": 10,
13+
"Q": 10,
14+
"K": 10,
15+
}
16+
17+
selection_1 = input("\nSelect the first of three cards: A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K. ")
18+
selection_2 = input("\nSelect the second card: A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K. ")
19+
selection_3 = input("\nSelect the third and last card: A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K. ")
20+
21+
selection_1_int = cards[selection_1]
22+
selection_2_int = cards[selection_2]
23+
selection_3_int = cards[selection_3]
24+
sum = selection_1_int + selection_2_int + selection_3_int
25+
26+
if sum < 17:
27+
print(f"\n{sum} Hit")
28+
29+
elif sum in range (17, 20):
30+
print(f"\n{sum} Stay")
31+
32+
elif sum == 21:
33+
print(f"\n{sum} Blackjack")
34+
35+
elif sum > 21:
36+
print(f"\n{sum} Already Busted")

0 commit comments

Comments
 (0)