Skip to content

Commit adb1efa

Browse files
authored
Update blackjack.py
Dialogue for when both the player and robot bust
1 parent 2833aa1 commit adb1efa

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

blackjack.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,21 @@ def blackjack(dealer_hand, player_hand):
6767
time.sleep(1)
6868
play_again()
6969

70+
def both(dealer_hand, play_again):
71+
if total(player_hand) >=22 and total(dealer_hand) >=22:
72+
print_results(dealer_hand, player_hand)
73+
time.sleep(1)
74+
print("Both you and the dealer bust!")
75+
7076
def score(dealer_hand, player_hand):
7177
if total(player_hand) == 21:
7278
print_results(dealer_hand, player_hand)
7379
time.sleep(1)
7480
print ("Congratulations! You got a Blackjack!\n")
81+
elif total(player_hand) >=22 and total(dealer_hand) >=22:
82+
print_results(dealer_hand, player_hand)
83+
time.sleep(1)
84+
print("Both you and the dealer bust!")
7585
elif total(dealer_hand) == 21:
7686
print_results(dealer_hand, player_hand)
7787
time.sleep(1)
@@ -91,7 +101,7 @@ def score(dealer_hand, player_hand):
91101
elif total(player_hand) > total(dealer_hand):
92102
print_results(dealer_hand, player_hand)
93103
time.sleep(1)
94-
print ("Congratulations. Your score is higher than the dealer. You win\n")
104+
print ("Congratulations. Your score is higher than the dealer. You win\n")
95105

96106
def game():
97107
choice = 0

0 commit comments

Comments
 (0)