-
Notifications
You must be signed in to change notification settings - Fork 0
/
blackJackGame
50 lines (40 loc) · 1.06 KB
/
blackJackGame
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# blackjack
import random
print("Welcome To Blackjack!")
choose = input("Press enter to start")
userNum = random.randint(1, 13)
compNum = random.randint(1, 13)
def getCard(num):
print("current total:", str(num))
card = random.randint(1, 13)
print("new card:", str(card))
num += card
print("new total:", str(num))
return num
def winner():
if compNum > userNum:
if(compNum > 21):
print("computer went over ; you win !")
else:
print("you lose !")
elif compNum < userNum:
print("you win !")
else:
print("push !")
while True:
print("\nYOUR TURN")
userNum = getCard(userNum)
if(userNum > 21):
print("you went over! you lose :(")
break
choose = input("hit or stand? ")
print("\nCOMPUTER TURN")
compNum = getCard(compNum)
if(choose == "stand"):
while compNum <= 21:
compNum = getCard(compNum)
print("")
winner()
break
# insurance : 11 can be used as one if total is over 21
# bet amount