salary = 30000 # 年薪
increase_rate = 0.08 # 工资涨幅
savings_rate = 0.4 # 存首付的比例
down_payment_percentage = 0.3 # 首付的比例
total_price = 200000 # 房子的总价
down_payment = total_price * down_payment_percentage # 首付的总数
monthly_savings = salary / 12 * savings_rate # 每月存的钱数
num_months = 0 # 小娟已经存了多少个月
savings = 0 # 小娟已经存了多少钱
while savings < down_payment:
num_months += 1
if num_months % 6 == 0:
salary *= (1 + increase_rate)
savings += monthly_savings
print(num_months)
【无标题】
最新推荐文章于 2024-11-05 15:28:12 发布