import random
def aggressiveGambling(moneyOfGambler):
numberOfBets=0
currentBetSize=1
while True:
numberOfBets+=1
if random.choice(["won","lost"])=="won":
print("Money owned before the bet:$"+str(moneyOfGambler)," Money won:$"+str(currentBetSize))
moneyOfGambler+=currentBetSize
currentBetSize=1
else:
print("Money owned before the bet:$"+str(moneyOfGambler)," Money lost:$"+str(currentBetSize))
moneyOfGambler-=currentBetSize
currentBetSize*=2
if moneyOfGambler<currentBetSize:
print("Not enough money to continue the game. Needed to bet $"+str(currentBetSize),", while having only $"+str(moneyOfGambler),"Total number of bets:",numberOfBets)
break
while True:
aggressiveGambling(int(input("Initial money(in dollars):")))