PracticeDev/study_python/save_money.py

15 lines
279 B
Python

#!/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)