Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit c59bd9a

Browse files
Merge pull request #666 from Carl283583/new-branch-blackjack
From new-branch-blackjack
2 parents 1ede9ae + 1c115c7 commit c59bd9a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

projects/BlackJack/black_jack.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def check_ace(card):
114114
115115
BlackJack means 21. Whoever gets a total value of 21 with their cards immediately wins!
116116
(winning through blackjack results in 3x the money)
117-
If the value of cards goes over 21, its called a BUST, which results in immediate loss...
117+
If the value of cards goes over 21, it's called a BUST, which results in an immediate loss...
118118
If both the players get the same value of cards , it's a TIE and the bet money is returned.
119119
120120
If none of the above cases are met ,the person with closer value to 21 wins.
@@ -138,6 +138,8 @@ def check_ace(card):
138138
if bet > chips:
139139
print("You dont have enough chips.")
140140
print("Enter a valid amount. \n")
141+
elif bet <= 0: #To prevent betting a negative value
142+
print("Invalid Bet")
141143
else:
142144
chips -= bet
143145
break
@@ -282,9 +284,12 @@ def check_ace(card):
282284
break
283285

284286
else:
287+
288+
285289
cont = input("Do you want to continue? (y/n) :")
290+
check= cont.upper()###So a capital or lowercase value can be entered
286291

287-
if cont == "y":
292+
if check == "Y":
288293
print("\n" * 100)
289294

290295
print(
@@ -304,7 +309,9 @@ def check_ace(card):
304309
print(input("Press Enter to exit the terminal..."))
305310
break
306311

312+
313+
307314
except Exception as error:
308315
print(f"Following error occurred : {error} \nPlease try again.")
309316
game_num -= 1 # round with error won't be counted
310-
continue
317+
continue

0 commit comments

Comments
 (0)