如何用语言编程求银行利息?求实验代码,外加结果抓图。(语言-python)

用Python语言编程实现,求解银行存款利息问题已知银行存款利率为1.9%,编写程序计算并输出需要存多少年,10000的存款本金才会连本带利翻一番。
提示:Savings= Savings+0.019*Savings
Savings = (1+0.019)*Savings
实验代码、结果(代码粘贴文本,结构抓图)

img

save = 10000
year = 0
while save < 20000:
    year += 1
    save = save*(1+0.019)
print(str(year)+"年以后,存款会翻番")
#复利情况下:

save = 10000
year = 0
while True:
    year += 1
    save *= 1+0.019
    if save>=20000:
        break
    
print(str(year)+"年以后,本息会翻番")

#非复利情况下:

save = 10000
year = 0
t = 0
while True:
    year += 1
    t += 0.019*save
    if t>=20000:
        break
    
print(str(year)+"年以后,本息会翻番")