Skip to content

Commit 7e9c271

Browse files
committed
finally done
1 parent 3c97986 commit 7e9c271

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

code/Andy/python/black_jack.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
jack = {
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+
} #putting all cards in a dict to be able to pull from when i get further down
16+
17+
gambler = input('pick your first card from this selection A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K: ').upper()
18+
gambler2 = input('pick your second card from this selection A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K: ').upper() #.upper at the end of the input only works if YOU PUT THE PARENTHESIS!
19+
gambler3 = input('pick your third card from this selection A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K: ').upper()
20+
21+
# if gambler == 'a' or 'j' or 'q' or 'k':
22+
# gambler == gambler.upper #one way of having it become an uppercase above is the waaay easier way of doing that. that works for sure
23+
first = jack[gambler]
24+
25+
second = jack[gambler2]
26+
third = jack[gambler3] #first second and third are vaiables that call dictionary of jack and use the input of the gambler to get the the value of their selection
27+
28+
sum = first + second + third #the addition of all their values into one variable
29+
30+
31+
32+
if sum < 17: #if below 17
33+
print(f'your value is {sum}. Adise to Hit!')
34+
35+
elif sum in range (17 ,20):
36+
print(f'your value is {sum}. Advise to STAY!') #if between 17 and 20
37+
38+
elif sum == 21: #if equal to 21
39+
print('BLACKJACK!')
40+
41+
elif sum > 21:
42+
print('BUST!') #if statments if greater than 21
43+
44+
45+
46+
# print(gambler.upper()) #.upper doesnt work on the outside of the inputs but works in the print statment. and need open and closing parenthesis for it to work
47+
48+
49+
50+
51+

0 commit comments

Comments
 (0)