PracticeDev/study_python/save_money.py

15 lines
279 B
Python
Raw Permalink Normal View History

2022-12-20 17:31:11 +08:00
#!/usr/bin/python3
#coding:utf-8
start = 4500
month = 12
rate = 0.027
money = 0
for i in range(1, month):
rate_money = start * rate / 12
print("%d个月的利息为:%f\n" % (i, rate_money))
money = money + rate_money
start = start - 5000 / 12
print(money)