Answer in python:
import random
money = 10
winnings = 0
def main():
global winnings
global money
dice_num = random.randrange(1,6)
input_str = "Guess the dice number. You have $"+str(money)+" > "
input_num = input(input_str)
if int(input_num) == dice_num:
money = money + 10
winnings = winnings + 10
else:
money = money - 1
if money < 0:
print("You lose. You won "+str(winnings)+" times. Press enter to try again")
useless_variable = input()
main()
else:
main()
main()
Step-by-step explanation: