Increasing Percentage Gamble

Python Puzzles

Back to the Python! homepage


A casino has a new game. A gambler can bet $10 and get a 1% chance of winning $100. If the gambler loses, they can bet another $10, and their chance of winning increases from 1% to 2%. After each loss, the gambler can bet $10, and the chance of winning will increase 1%.

What is the average number of bets the gambler must place to win the $100? Is this game in favor of the gambler or the casino?


The game is definitely in favor of the casino. On average, you would spend over $120 to win $100.

Average number of bets: 12.1667

Here is the Python code to run the simulation.

import random

def play_game():
    bet = 10
    win_probability = 0.01
    num_bets = 0

    while True:
        num_bets += 1
        if random.random() < win_probability:
            return num_bets, 100
        else:
            win_probability += 0.01
            bet += 10

average_bets = 0
num_iterations = 10000

for i in range(num_iterations):
    bets, payout = play_game()
    average_bets += bets

print("Average number of bets:", average_bets / num_iterations)