Skip to content

Commit d0e1874

Browse files
committed
pull lab 4 from lab 3 complete
1 parent 2553848 commit d0e1874

File tree

2 files changed

+47
-174
lines changed

2 files changed

+47
-174
lines changed

code/daniel/03_NumberToPhrase/NumberToPhrase.py

Lines changed: 0 additions & 165 deletions
This file was deleted.

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

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,57 @@
4949
Question1 = input("What's your first card?: ")
5050
Question2 = input("What's your second card?: ")
5151
Question3 = input("What's your third card?: ")
52+
cardTotal = 0
53+
54+
while True:
55+
if Question1 in Facecards:
56+
cardTotal += int(Facecards[Question1])
57+
print(f"Question1: {Question1}")
58+
59+
if Question2 in Facecards:
60+
cardTotal += int(Facecards[Question2])
61+
print(f"Question1: {Question2}")
62+
63+
if Question3 in Facecards:
64+
cardTotal += int(Facecards[Question3])
65+
print(f"Question1: {Question3}")
66+
break
67+
else:
68+
print("Not valid")
69+
break
70+
else:
71+
print("Not valid")
72+
break
73+
else:
74+
print("Not valid")
75+
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}")
84+
else:
85+
print("Not Valid")
5286

53-
total = int(Question1) + int(Question2) + int(Question3)
5487

5588

89+
# print(cardTotal)
5690

57-
if total < 17:
58-
print("Hit")
59-
elif total <= 17 and total < 21:
60-
print("Stay")
61-
elif total == 21:
62-
print("BlackJack!")
63-
else:
64-
print("Busted")
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")
65103

66104

67105

0 commit comments

Comments
 (0)