楼主: titics
3467 11

【小小白学 Python】 请各位师兄多多指点,谢谢! [推广有奖]

11
titics 发表于 2014-12-7 15:09:46
intial = 1000
rate = 0.05
numyears = 5
year = 1
while year <= numyears:
    intial = intial * (1+rate)
    print (year, intial)
    year +=1


# 增加 input () 的使用

principal = input ("What is your principal? ", )
principal = int (principal)
rate = 0.20
numyears = 5
year = 1
while year <= numyears:
    principal = principal * (1 + rate)
    print ("%3d %0.2f" % (year, principal))
    year += 1

12
titics 发表于 2015-8-22 12:04:37
Python科学计算环境推荐——Anaconda       参阅   http://www.jb51.net/article/51651.htm

Anaconda下载地址:http://continuum.io/downloads

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-28 15:42