1、打开python的idle,按ctrl+n新建一个窗口:


2、输入如下代码:
# -*- coding: GB2312 -*-
#手动输入回报率
roe = raw_input("回报率为: ")
#设置年份
year = raw_input("年份: ")
#设置初始金额,默认10000
ori = 10000
count = 1
while count <= int(year):
output = ori*( 1 +int(roe)*0.01)**count
仗针 print("第"艳册+str(count)+"年: "+str(int(output)))
count = count + 1

3、按F5运行,填写回报率和年杰醒政份后得到如图结果。教程结束。
