1 Star 0 Fork 0

蛮大人/Python In action Lesson

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
lession01.py 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
蛮大人 提交于 2015-10-21 23:14 . 更新提交自己的练习
#!/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))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mdr/Python-In-action-Lesson.git
git@gitee.com:mdr/Python-In-action-Lesson.git
mdr
Python-In-action-Lesson
Python In action Lesson
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385