
Patrick B. answered 03/27/21
Math and computer tutor/teacher
print(" current balance is : "+ str(balance))
print("Game:")
wager = -1
while (float(wager)<0) or (float(wager)>balance):
wager = input(" bet amount:>")
goal = -1
gameOver = False
firstRoll = RollDice()
print(" First roll is :" + str(firstRoll))
if (int(firstRoll)==2) or (int(firstRoll)==3) or (int(firstRoll)==12):
print(" YOU LOSE !!!! ")
balance = float(balance)-float(wager)
gameOver = True
elif (int(firstRoll==7)) or (int(firstRoll)==11):
print(" YOU WIN !!!! ")
balance = float(balance)+float(wager)
gameOver = True
else:
goal = firstRoll
print("goal is " + str(goal))
while not gameOver:
nextRoll = RollDice()
print("next roll is " +str(nextRoll))
if int(nextRoll)==int(goal):
print("YOU WIN !!!! ")
balance =float(balance)+float(wager)
gameOver= True
elif int(nextRoll)==7:
print(" YOU LOSE !!!! ")
balance = float(balance)-float(wager)
gameOver = True
nextRoll = RollDice()