Skip to content

Commit 04b3ec2

Browse files
committed
Fixed text > camel to snake
1 parent 0b966d4 commit 04b3ec2

File tree

1 file changed

+22
-37
lines changed

1 file changed

+22
-37
lines changed

code/daniel/04_BlackJackAdvice/daniel-Lab4-Blackjack Advice.py

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
import random
3232

33-
Facecards = {
33+
face_cards = {
3434
"K": 10,
3535
"Q": 10,
3636
"J": 10,
@@ -46,23 +46,23 @@
4646
"A": 1
4747
}
4848

49-
Question1 = input("What's your first card?: ")
50-
Question2 = input("What's your second card?: ")
51-
Question3 = input("What's your third card?: ")
52-
cardTotal = 0
49+
question_1 = input("What's your first card?: ")
50+
question_2 = input("What's your second card?: ")
51+
question_3 = input("What's your third card?: ")
52+
card_total = 0
5353

5454
while True:
55-
if Question1 in Facecards:
56-
cardTotal += int(Facecards[Question1])
57-
print(f"Question1: {Question1}")
55+
if question_1 in face_cards:
56+
card_total += int(face_cards[question_1])
57+
print(f"question_1: {question_1}")
5858

59-
if Question2 in Facecards:
60-
cardTotal += int(Facecards[Question2])
61-
print(f"Question1: {Question2}")
59+
if question_2 in face_cards:
60+
card_total += int(face_cards[question_2])
61+
print(f"question_2: {question_2}")
6262

63-
if Question3 in Facecards:
64-
cardTotal += int(Facecards[Question3])
65-
print(f"Question1: {Question3}")
63+
if question_3 in face_cards:
64+
card_total += int(face_cards[question_3])
65+
print(f"question_3: {question_3}")
6666
break
6767
else:
6868
print("Not valid")
@@ -73,34 +73,19 @@
7373
else:
7474
print("Not valid")
7575
break
76-
if cardTotal < 17:
77-
print(f"Hit {cardTotal}")
78-
elif 17 <= cardTotal < 21:
79-
print(f"Stay {cardTotal}")
80-
elif cardTotal == 21:
81-
print(f"Backjack! {cardTotal}")
82-
elif cardTotal > 21:
83-
print(f"Already Busted {cardTotal}")
76+
if card_total < 17:
77+
print(f"Hit {card_total}")
78+
elif 17 <= card_total < 21:
79+
print(f"Stay {card_total}")
80+
elif card_total == 21:
81+
print(f"Backjack! {card_total}")
82+
elif card_total > 21:
83+
print(f"Already Busted {card_total}")
8484
else:
8585
print("Not Valid")
8686

8787

8888

89-
# print(cardTotal)
90-
91-
# total = int(Question1) + int(Question2) + int(Question3)
92-
93-
94-
95-
# if total < 17:
96-
# print("Hit")
97-
# elif total <= 17 and total < 21:
98-
# print("Stay")
99-
# elif total == 21:
100-
# print("BlackJack!")
101-
# else:
102-
# print("Busted")
103-
10489

10590

10691
# Version 2 (optional)

0 commit comments

Comments
 (0)