本書簡介: 本書定位于編程思維訓練,依托 Python 程序設計語言,通過豐富的實例,輔助讀者實現(xiàn)編程領域“從 0 到 1”的突破;本書同時配有在線編程實踐平臺,自動評測,輔助讀者進行個性化學習。本書獲教育部產學合作協(xié)同育人項目及山東省自然科學基金重大基礎研究項目資助。本書邏輯清晰,內容簡潔,不僅適合計算機相關專業(yè)的低年級同學作為教材使用,也適合其他專業(yè)的學生或讀者作為編程入門教材使用。
丁艷輝,漢族,1981年1月出生,山東棗莊人,中共黨員,2010年6月畢業(yè)于山東大學計算機軟件與理論專業(yè),獲工學博士學位,F(xiàn)為山東師范大學信息科學與工程學院教授、碩士生導師,中國計算機協(xié)會信息系統(tǒng)專業(yè)委員會委員。2015年1月至2015年12月,在香港科技大學做訪問學者;2016年3月至2017年4月,在美國賓夕法尼亞大學做訪問學者。 主要研究領域包括Web數據集成、基于機器學習的醫(yī)學圖像分析等;主持國家自然科學基金青年項目1項、省部級項目2項;在《計算機學報》、Journal of Computer Science and Technology等期刊和國內外學術會議上發(fā)表論文10余篇;獲山東省科技進步二等獎(第4位)1項。
第 1 章 Python 簡介 ··············································································.1
1.1 編程思維 ··················································································.1
1.2 Python 發(fā)展歷史 ········································································.2
1.2.1 Python 簡介 ·····································································.2
1.2.2 Python 的特點 ··································································.3
1.3 課程輔助平臺介紹 ······································································.4
第 2 章 編寫第一個程序 ·········································································.5
2.1 入門實例——Hello World! ····························································.5
2.1.1 安裝 Python 3.x 版本 ·························································.5
2.1.2 交互模式 ·········································································.6
2.1.3 腳本模式 ·········································································.7
2.2 相關知識點 ···············································································10
2.3 整章知識點 ···············································································12
2.4 進階實例 ··················································································18
2.5 小結 ························································································18
第 3 章 基本數據類型 ············································································19
3.1 入門實例——年齡計算器 ·····························································19
3.2 相關知識點 ···············································································20
3.3 基本數據類型知識點 ···································································21
3.4 進階實例 ··················································································37
3.5 小結 ························································································38
第 4 章 選擇結構 ··················································································39
4.1 入門實例——數字比大小游戲 ·······················································39
4.2 相關知識點 ···············································································40
4.3 選擇結構知識點 ·········································································42
4.4 進階實例 ··················································································49
4.5 小結 ························································································52
第 5 章 循環(huán)結構 ··················································································53
5.1 入門實例——“石頭 - 剪刀 - 布”游戲升級版 ···································53
5.2 相關知識點 ···············································································55
5.3 循環(huán)結構知識點 ·········································································56
5.4 進階實例 ··················································································68
5.5 小結 ························································································72
第 6 章 函數 ························································································73
6.1 入門實例——計算任意整數的階乘 ·················································73
6.2 相關知識點 ···············································································75
6.3 函數知識點 ···············································································77
6.4 進階實例 ··················································································93
6.5 小結 ·····················································································.100
第 7 章 海龜繪圖 ···············································································.101
7.1 入門實例——第一只海龜 ··························································.101
7.2 相關知識點 ············································································.102
7.3 海龜繪圖知識點 ······································································.103
7.4 進階實例 ···············································································.111
7.5 小結 ·····················································································.115
第 8 章 列表 ·····················································································.116
8.1 入門實例——彩虹的顏色 ··························································.116
8.2 相關知識點 ············································································.117
8.3 列表知識點 ············································································.118
8.4 進階實例 ···············································································.124
8.5 小結 ·····················································································.125
第 9 章 元組 ·····················································································.126
9.1 入門實例——學生信息 ·····························································.126
9.2 相關知識點 ············································································.126
9.3 元組知識點 ············································································.127
9.4 進階實例 ···············································································.131
9.5 小結 ·····················································································.131
第 10 章 字典 ····················································································.132
10.1 入門實例——電話號碼簿 ························································.132
10.2 相關知識點 ··········································································.133
10.3 字典知識點 ··········································································.133
10.4 進階實例 ·············································································.137
10.5 小結 ···················································································.142
第 11 章 模塊 ····················································································.143
11.1 入門實例——計算機隨機選擇“石頭”“剪刀”“布” ·······················.143
11.2 相關知識點 ··········································································.144
11.3 模塊知識點 ··········································································.144
11.4 進階實例 ·············································································.152
11.5 小結 ···················································································.153
第 12 章 文件操作 ··············································································.154
12.1 入門實例——讀取文字迷宮 ·····················································.154
12.2 相關知識點 ··········································································.156
12.3 文件操作知識點 ····································································.157
12.4 進階實例 ·············································································.166
12.5 小結 ···················································································.166
第 13 章 類和對象 ··············································································.167
13.1 入門實例——汽車類 ······························································.167
13.2 相關知識點 ··········································································.168
13.3 類和對象知識點 ····································································.171
13.4 進階實例 ·············································································.176
13.5 小結 ···················································································.179
第 14 章 Python 操作數據庫 ·································································.180
14.1 入門實例——創(chuàng)建一張關系表 ··················································.180
14.2 相關知識點 ··········································································.181
14.3 Python 操作數據庫知識點 ························································.182
14.4 進階實例 ·············································································.189
14.5 小結 ···················································································.197
第 15 章 GUI 編程 ··············································································.198
15.1 入門實例——第一個窗口程序 ··················································.198
15.2 相關知識點 ··········································································.199
15.3 GUI 編程知識點 ····································································.200
15.4 進階實例 ·············································································.207
15.5 小結 ···················································································.209