-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdice_game.py
More file actions
30 lines (28 loc) · 821 Bytes
/
dice_game.py
File metadata and controls
30 lines (28 loc) · 821 Bytes
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
import random
min = 1
max = 6
bank = 11
high = 0
roll_again = "yes"
while roll_again == "yes" or roll_again == "y" and bank != 0:
dice1 = (random.randint(min, max))
dice2 = (random.randint(min, max))
print ("Rolling the dices...")
print ("The values are....")
print ("dice 1 = ",dice1)
print ("dice 2 = ",dice2)
total = dice1 + dice2
print ("Roll Total ",total )
if dice1 + dice2 == 7:
bank = bank + 4
if bank > high:
high = bank
else:
break
elif bank == 0:
print ("You're broke! You had $",high," before loosing it all!")
else:
bank = bank - 1
print ("You have a balance of:" ,bank)
print ("You're current high is: ",high)
roll_again = input("Roll the dices again? ")