monthly_deposit = float(input("请输入每月存款数:"))
interest_rate = 0.05/12 # 年利率转化为月利率
account_balance = 0
for _ in range(6):
account_balance = (account_balance + monthly_deposit) * (1 + interest_rate)
print("6个月后的账户余额为:", round(account_balance, 2))
Python练习题
最新推荐文章于 2024-09-03 17:37:40 发布