initial_balance_1 = 30000 # Starting amount in Account 1
monthly_addition = 1000 # Monthly addition to Account 1
daily_rate_1 = 0.16 / 365 # Daily interest rate for Account 1
daily_rate_2 = 0.12 / 365 # Daily interest rate for Account 2
years = 10 # Total duration in years
days = years * 365 # Total number of days
min_percentage = 0.1 # Minimum percentage required in Account 2
# Variables
balance_1 = initial_balance_1 # Current balance in Account 1
balance_2 = 0 # Current balance in Account 2
total_interest_1 = 0 # Total interest earned by Account 1
total_interest_2 = 0 # Total interest earned by Account 2
# Simulation
for day in range(1, days + 1):
# Calculate daily interest for Account 1
interest_1 = balance_1 * daily_rate_1
total_interest_1 += interest_1
# Transfer daily interest to Account 2
balance_2 += interest_1
# Calculate daily interest for Account 2
interest_2 = balance_2 * daily_rate_2
total_interest_2 += interest_2
# Add daily interest to Account 2
balance_2 += interest_2
# Ensure Account 2 has at least 10% of Account 1's balance
if balance_2 < min_percentage * balance_1:
deficit = min_percentage * balance_1 - balance_2
balance_2 += deficit
balance_1 -= deficit
# Add monthly addition to Account 1 on the first day of each month
if day % 30 == 0:
balance_1 += monthly_addition
# Results
total_balance_1 = balance_1
total_balance_2 = balance_2
total_combined = total_balance_1 + total_balance_2
(total_balance_1, total_balance_2, total_interest_1, total_interest_2, total_combined)
print(total_combined)