代码拉取完成,页面将自动刷新
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2015-10-14 19:36:00
# @Author : Kang.cunhua (358608208@qq.com)
# @Link : https://git.oschina.net/mdr/
# @Version : $Id$
# 小练习4 :存10000块钱,年利率是3.25%,求多少年之后,存款能翻番
im = 10000
iy = 0
while im < 20000:
im *= 1 + 0.0325
iy += 1
print 'need: ' + str(iy) + 'years'
# need: 22years
# 练习8 getMax2vauleofList
# 作业:
# 一个序列[1,2,3,2,12,3,1,3,21,2,2,3,4111,22,3333,444,111,4,5,777,65555,45,33,45]
# 求这个list的最大的两个值
l = [1, 2, 3, 2, 12, 3, 1, 3, 21, 2, 2, 3, 4111, 22,
3333, 444, 111, 4, 5, 777, 65555, 45, 33, 45]
l.sort()
print 'max' + str(l[-1])
# max65555
print '2max:' + str(l[-2])
# In [6]: 2max:4111
#
# 练习,list的长度
l = ['td', 'pc', 'comper', 'wa']
print l
print str(len(l))
# pc', 'comper', 'wa']
print l
print str(len(l))
# pc', 'comper', 'wa']
print l
print str(len(l))
# pc', 'comper', 'wa']
print l
print str(len(l))
# pc', 'comper', 'wa']
print l
print str(len(l))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。