没有合适的资源?快使用搜索试试~ 我知道了~
像计算机科学家一样思考python.pdf
需积分: 23 3 下载量 160 浏览量
2017-07-03
16:08:58
上传
评论
收藏 712KB PDF 举报
温馨提示
像计算机科学家一样思考python.的翻译版pdf
资源推荐
资源详情
资源评论
- 1 -
像计算机
科学家那样思考
(中文版)
- 2 -
目 录
贡献者名单...........................................................................................................................................I
前言.....................................................................................................................................................V
序言.................................................................................................................................................. VII
1 程序之道.......................................................................................................................................1
1.1 Python 程序语言...............................................................................................................1
1.2 程序是什么? ....................................................................................................................3
1.3 除虫是什么? ....................................................................................................................3
1.4 语法错误(Syntax errors)...............................................................................................4
1.5 执行错误(Runtime errors)............................................................................................4
1.6 语意错误(Semantic errors)...........................................................................................4
1.7 实验性除虫 ........................................................................................................................4
1.8 形式语言及自然语言 ........................................................................................................5
1.9 第一个程序 ........................................................................................................................7
1.10 术语.................................................................................................................................7
1.11 练习 ....................................................................................................................................9
2 变数、表达式及陈述.................................................................................................................11
2.1 数值与型态 ......................................................................................................................11
2.2 变数 ..................................................................................................................................12
2.3 变量名称与关键词 ..........................................................................................................13
2.4 陈述 ..................................................................................................................................14
2.5 表达式求值 ......................................................................................................................14
2.6 运算子与操作数 ..............................................................................................................15
2.7 运算的次序 ......................................................................................................................16
2.8 字符串的运算 ..................................................................................................................16
2.9 输入 ..................................................................................................................................17
2.10 组合...............................................................................................................................17
2.11 批注 ..................................................................................................................................18
2.12 术语...............................................................................................................................18
2.13 练习...............................................................................................................................20
3 函数.............................................................................................................................................22
3.1 函数定义及用法 ..............................................................................................................22
3.2 执行流程 ..........................................................................................................................24
3.3 参数、自变量以及 import 陈述 ..................................................................................24
3.4 组合 ..................................................................................................................................26
3.5 区域的概念:变数及参数 ..............................................................................................26
3.6 堆栈图 ..............................................................................................................................27
3.7 术语 ..................................................................................................................................28
3.8 练习 ..................................................................................................................................30
4 条件式.........................................................................................................................................32
4.1 余数运算子 ......................................................................................................................32
4.2 布尔值与表达式 ..............................................................................................................32
4.3 逻辑运算子 ......................................................................................................................33
4.4 条件执行 ..........................................................................................................................33
- 3 -
4.5 替代执行 ..........................................................................................................................34
4.6 炼状条件式 ......................................................................................................................35
4.7 巢状条件式 ......................................................................................................................35
4.8 return 陈述.......................................................................................................................36
4.9 键盘输入 ..........................................................................................................................36
4.10 型态转换.......................................................................................................................37
4.11 Gasp..................................................................................................................................39
4.12 术语...............................................................................................................................40
4.13 练习...............................................................................................................................41
5 多效函数.....................................................................................................................................46
5.1 传回值 ..............................................................................................................................46
5.2 程序开发 ..........................................................................................................................47
5.3 函数的组合 ......................................................................................................................49
5.4 布尔函数 ..........................................................................................................................50
5.5 函数(function)型态.....................................................................................................50
5.6 有型的程序设计 ..............................................................................................................51
5.7 三引号字符串 ..................................................................................................................52
5.8 用 doctest 做单元测试 ................................................................................................52
5.9 术语 ..................................................................................................................................54
5.10 练习...............................................................................................................................55
6 重复.............................................................................................................................................60
6.1 多重指派 ..........................................................................................................................60
6.2 更新变数 ..........................................................................................................................60
6.3 while 陈述 .......................................................................................................................61
6.4 追踪一个程序 ..................................................................................................................62
6.5 计算数字 ..........................................................................................................................63
6.6 缩写指派 ..........................................................................................................................64
6.7 表格 ..................................................................................................................................65
6.8 二维表格 ..........................................................................................................................66
6.9 封装与一般化 ..................................................................................................................66
6.10 更多的封装...................................................................................................................67
6.11 区域变量 ..........................................................................................................................68
6.12 更多的一般化...............................................................................................................68
6.13 函数...............................................................................................................................70
6.14 牛顿勘根法...................................................................................................................70
6.15 算法...............................................................................................................................70
6.16 术语...............................................................................................................................71
6.17 练习...............................................................................................................................72
7 对照上面的 doctests 检查你的答案。7. 字符串...................................................................75
7 7. 字符串....................................................................................................................................76
7.1 复合数据型态 ..................................................................................................................76
7.2 长度 ..................................................................................................................................76
7.3 走访以及 for 循环 ........................................................................................................77
7.4 字符串切片 ......................................................................................................................78
7.5 字符串比较 ......................................................................................................................79
7.6 字符串是不可变的 ..........................................................................................................79
- 4 -
7.7 in 运算子 ........................................................................................................................79
7.8 A find 函数 ....................................................................................................................80
7.9 循环及参数 ......................................................................................................................81
7.10 选择性参数...................................................................................................................81
7.11 string 模块.......................................................................................................................82
7.12 字符的分类...................................................................................................................83
7.13 字符串格式化...............................................................................................................84
7.14 索引...............................................................................................................................86
7.15 练习...............................................................................................................................87
8 案例研究: Catch .....................................................................................................................91
8.1 起步 ..................................................................................................................................91
8.2 用 while 移动球 ............................................................................................................91
8.3 程度的调整 ......................................................................................................................92
8.4 使球弹回 ..........................................................................................................................93
8.5 break 陈述 .......................................................................................................................93
8.6 响应键盘 ..........................................................................................................................94
8.7 检查碰撞 ..........................................................................................................................95
8.8 组合这些片段 ..................................................................................................................96
8.9 显示文字 ..........................................................................................................................97
8.10 抽象化...........................................................................................................................98
8.11 术语 ................................................................................................................................101
8.12 练习.............................................................................................................................102
8.13 专题: pong.py..........................................................................................................102
9 Tuple .........................................................................................................................................104
9.1 可变性与 tuple..............................................................................................................104
9.2 Tuple 指派.....................................................................................................................105
9.3 Tuple 做为传回值.........................................................................................................106
9.4 随机数字 ........................................................................................................................106
9.5 随机数字列表 ................................................................................................................107
9.6 计算 ................................................................................................................................108
9.7 许多分区 ........................................................................................................................109
9.8 一个单程的解决方法 ....................................................................................................111
9.9 术语 ................................................................................................................................112
10 缺少 .......................................................................................................................................114
11 档案和例外 ...........................................................................................................................115
11.1 文字文件 ........................................................................................................................117
11.2 写入变数 ........................................................................................................................119
11.3 目录 ................................................................................................................................121
11.4 腌制 ................................................................................................................................122
11.5 例外 ................................................................................................................................123
11.6 术语 ................................................................................................................................126
12 类别与对象 ...........................................................................................................................128
12.1 使用者设定的复合型态.............................................................................................128
12.2 属性.............................................................................................................................129
12.3 以实例作为自变量.....................................................................................................130
12.4 相同性.........................................................................................................................130
- 5 -
12.5 矩形.............................................................................................................................132
12.6 以实例作为传回值.....................................................................................................133
12.7 物件是可变的.............................................................................................................133
12.8 复制.............................................................................................................................134
12.9 术语.............................................................................................................................136
13 类别与函数 ...........................................................................................................................137
13.1 Time 类别......................................................................................................................137
13.2 纯函数.........................................................................................................................137
13.3 修饰子.........................................................................................................................139
13.4 哪一个比较好?.........................................................................................................141
13.5 原型开发 V.S. 计划 ..................................................................................................141
13.6 一般化.........................................................................................................................142
13.7 算法.............................................................................................................................143
13.8 术语.............................................................................................................................143
14 类别与方法 ...........................................................................................................................145
14.1 对象导向功能.............................................................................................................145
14.2 printTime ......................................................................................................................145
14.3 另一个范例.................................................................................................................147
14.4 一个更为复杂的范例.................................................................................................148
14.5 选择性自变量.............................................................................................................149
14.6 初始化方法.................................................................................................................150
14.7 重新审视 Points.........................................................................................................152
14.8 运算子多载.................................................................................................................153
14.9 多形(Polymorphism) .............................................................................................154
14.10 术语.............................................................................................................................156
剩余171页未读,继续阅读
资源评论
cctt66
- 粉丝: 0
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功