pull down to refresh

A newer version of the code that includes limits for losing and winning:
import random # player variables # ======================= budget = 100_000 win_limit = 10_000 loss_limit = 10_000 bet = 1 choice = "red" # choice = "black" max_bet = 200_000 # ======================= # Game simulation actual_bet = bet actual_budget = budget spin = 1 red = [1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36] black = [2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35] while actual_budget <= budget + win_limit -1 and actual_budget - actual_bet >= budget - loss_limit: if actual_bet > actual_budget: print("You don't have enough money.") print(f"Your final budget is {actual_budget}") break if actual_bet > max_bet: print("Your bet is higher than max bet.") print(f"Your final budget is {actual_budget}") break spin_number = random.randint(0, 36) print(f"Your bet is {actual_bet}") print(f"{spin}. spin, {spin_number}") spin += 1 if choice == "red": if spin_number in red: win_check = True print(f"You win {actual_bet}") else: win_check = False print(f"You loose {actual_bet}") elif choice == "black": if spin_number in black: win_check = True print(f"You win {actual_bet}") else: win_check = False print(f"You loose {actual_bet}") if win_check: actual_budget += actual_bet actual_bet = bet else: actual_budget -= actual_bet actual_bet = actual_bet * 2 print(f"Now you have {actual_budget}.") print()