父與子的編程之旅:與爸爸一起學(xué)Python
本書(shū)分為12個(gè)單元,通過(guò)科學(xué)、合理的結(jié)構(gòu),以親切的筆調(diào)、活潑的對(duì)話介紹了Python編程的相關(guān)知識(shí)。用有趣的例子,借助可愛(ài)的漫畫(huà)生動(dòng)形象地介紹了包括變量、輸入輸出語(yǔ)句、循環(huán)語(yǔ)句、列表、對(duì)象等編程的基本概念。學(xué)習(xí)本書(shū)的內(nèi)容,可以幫助孩子掌握計(jì)算機(jī)的思維方式,而書(shū)中可視化和以游戲?yàn)橹鞯睦涌梢约ぐl(fā)孩子的學(xué)習(xí)興趣,培養(yǎng)其專注力。
本書(shū)每單元末尾均設(shè)置有“小試牛刀”和“小小總結(jié)”板塊,可以拓展讀者的思維,鞏固學(xué)習(xí)的知識(shí)和技能。本書(shū)是寫(xiě)給孩子看的Python編程書(shū),也適合父母、老師、學(xué)生,以及想要了解計(jì)算機(jī)編程基礎(chǔ)知識(shí)、學(xué)習(xí)Python編程技能的未成年人閱讀,同時(shí)還可以作為少兒編程的教材參考用書(shū)。
賈煒,高級(jí)工程師,對(duì)多種開(kāi)發(fā)語(yǔ)言都有深入研究,專注于Python人工智能開(kāi)發(fā)、數(shù)據(jù)分析、機(jī)器學(xué)習(xí)等;長(zhǎng)期從事青少年STEAM教育培訓(xùn)工作,有豐富的教育培訓(xùn)經(jīng)驗(yàn)。
單元一 認(rèn)識(shí) Python 語(yǔ)言 13
1.1 什么是人工智能14
1.2 了解 Python 編程語(yǔ)言17
1.3 Python 與人工智能 18
1.4 編寫(xiě) Python 程序19
小試 牛刀26
小小 總結(jié)··················································································· 27
單元二 加減乘除樣樣行 ··················································· 29
2.1 加減法運(yùn)算 ··········································································· 30
2.2 乘法運(yùn)算·············································································· 34
2.3 除法運(yùn)算·············································································· 36
2.4 取余運(yùn)算·············································································· 38
2.5 輸入函數(shù) input ······································································ 39
單元三 判斷與比較 ························································· 45
3.1 關(guān)系運(yùn)算符 ··········································································· 46
3.2 True(真)和 False(假)······················································· 47
3.3 如果……那么……·································································· 49
3.4 如果……那么……否則……······················································ 52
單元四 海龜漫步 ···························································· 57
4.1 畫(huà)一條直線 ··········································································· 58
4.2 畫(huà)等邊三角形········································································ 60
4.3 畫(huà)正方形···············································································61
4.4 畫(huà)圓形················································································· 63
4.5 給圖形加點(diǎn)顏色····································································· 65
單元五 琢磨不透的隨機(jī)數(shù) ················································ 71
5.1 一個(gè)隨機(jī)數(shù) ··········································································· 72
5.2 與電腦猜拳··········································································· 75
5.3 隨機(jī)漫步·············································································· 79
單元六 永不休止的循環(huán) ··················································· 87
6.1 循環(huán)舉例 ·············································································· 88
6.2 有限循環(huán)·············································································· 89
6.3 無(wú)限循環(huán)·············································································· 92
單元七 一個(gè)大容器 ························································· 99
單元八 程序也有組織 ·····················································109
8.1 給程序取個(gè)名字 ···································································· 110
8.2 函數(shù)的參數(shù)·········································································· 113
8.3 函數(shù)的返回值······································································· 116
單元九 信息的長(zhǎng)久保存 ················································· 123
9.1 文件的建立 ··········································································124
9.2 讀取文件內(nèi)容·······································································125
9.3 向文件寫(xiě)入內(nèi)容····································································127
9.4 文件追加內(nèi)容······································································· 131
單元十 我的零花錢(qián)我管理 ···············································139
單元十一 面向?qū)ο缶幊毯芎?jiǎn)單 ·········································155
11.1 何為面向?qū)ο?······································································156
11.2 如何創(chuàng)建一個(gè)類···································································157
11.3 類的屬性與方法···································································158
11.4 對(duì)象的創(chuàng)建·········································································160
單元十二 彈球游戲 ························································165
附錄 A Python 的安裝與配置··········································183
附錄 B 專業(yè)詞匯速查表··················································190