def creatTable(principal,apr):
#为每一年绘制星号的增长图
for year in range(1,11):
principal=principal*(1+apr)
print("%2d"%year,end='')
total=caculateNum(principal)
print("*"*total)
print("0.0k 2.5k 5.0k 7.5k 10.0k")
def caculateNum(principal):
total=int(principal*4/1000.0)
return total
def main():
print("这是银行余额的增长星号图:")
#输入本金和利率
principal=eval(input("Enter the initial principal:"))
apr=eval(input("Enter the annualized rate:"))
#建立图标
creatTable(principal,apr)
main()
python银行账户增长图
最新推荐文章于 2022-11-08 17:24:51 发布