SlideShare a Scribd company logo
封面
书名
版权
前言
目录
第1章 Python基础——认识环境
1.1 认识Python
1.2 用Python编写程序
1.3 运行Python程序
1.4 本章小结
1.5 编程挑战
第2章 海龟作图——用Python绘图
2.1 第一个海龟程序
2.1.1 程序是如何工作的
2.1.2 发生了什么
2.2 旋转的海龟
2.3 海龟画圆
2.4 添加颜色
2.4.1 一个四色螺旋线
2.4.2 修改背景颜色
2.5 一个变量搞定一切
2.6 本章小结
2.7 编程挑战
第3章 数字和变量——用Python做数学运算
3.1 变量——保存内容的地方
3.2 Python中的数字和数学运算
3.2.1 Python数字
3.2.2 Python操作符
3.2.3 在Python shell中进行数学运算
3.2.4 语法错误——你说什么
3.2.5 Python shell中的变量
3.2.6 用操作符编程——比萨计算器
3.3 字符串——Python中真正的字符
3.4 用字符串改进彩色螺旋线
3.5 列表——将所有内容放到一起
3.6 Python做作业
3.7 本章小结
3.8 编程挑战
第4章 循环很有趣(你可以再说一遍)
4.1 构建自己的循环
4.1.1 使用for循环生成四个圆组成的玫瑰花瓣
4.1.2 修改循环让玫瑰花瓣带有6个圆
4.2 把玫瑰花瓣程序改进为允许用户输入
4.3 游戏循环和while循环
4.4 家庭成员螺旋线
4.5 整合——病毒式的螺旋线
4.6 本章小结
4.7 编程挑战
第5章 条件(如果是这样该怎么办?)
5.1 if语句
5.2 认识布尔值
5.2.1 比较操作符
5.2.2 你还不够大!
5.3 else语句
5.3.1 多边形或玫瑰花瓣
5.3.2 偶数还是奇数
5.4 elif语句
5.5 复杂条件——if、and、or和not
5.6 秘密消息
5.6.1 打乱字符串
5.6.2 字符的值
5.6.3 加密/解密程序
5.7 本章小结
5.8 编程挑战
第6章 随机的乐趣和游戏(继续前进,抓住机会!)
6.1 猜数字游戏
6.2 彩色的随机螺旋线
6.2.1 选取颜色——任意的颜色
6.2.2 获取坐标
6.2.3 画布有多大
6.2.4 整合
6.3 Rock-Paper-Scissors
6.4 选一张牌——任意一张牌
6.4.1 堆牌
6.4.2 发牌
6.4.3 计算牌面
6.4.4 继续前进
6.4.5 整合
6.5 掷骰子
6.5.1 设置游戏
6.5.2 对骰子排序
6.5.3 测试骰子
6.5.4 整合
6.6 万花筒
6.7 本章小结
6.8 编程挑战
第7章 函数(那些东西有了一个名字)
7.1 用函数整合内容
7.1.1 定义random_spiral()
7.1.2 调用random_spiral()
7.2 参数——传给函数
7.2.1 在随机位置微笑
7.2.2 整合
7.3 返回——发回统计结果
7.3.1 从函数返回一个值
7.3.2 在程序中使用返回值
7.4 交互简介
7.4.1 处理事件——TurtleDraw
7.4.2 监听键盘事件——ArrowDraw
7.4.3 用参数处理事件——ClickSpiral
7.4.4 更进一步——ClickandSmile
7.5 ClickKaleidoscope
7.5.1 draw kaleido()函数
7.5.2 draw_spiral()函数
7.5.3 整合
7.6 本章小结
7.7 编程挑战
第8章 定时器和动画
8.1 获取Pygame的所有GUI
8.1.1 Pygame画一个点
8.1.2 Pygame中的新内容
8.1.3 游戏的部分
8.2 时间刚刚好——移动和弹跳
8.2.1 移动笑脸
8.2.2 用Clock类实现笑脸动画
8.2.3 将笑脸从墙上弹开
8.2.4 在四面墙上弹回笑脸
8.3 本章小结
8.4 编程挑战
第9章 用户交互——进入游戏
9.1 增加交互——点击和拖动
9.1.1 点击点
9.1.2 拖动绘制
9.2 高级交互——笑脸爆炸
9.2.1 笑脸精灵
9.2.2 设置精灵
9.2.3 更新精灵
9.2.4 较大的和较小的笑脸
9.2.5 整合
9.3 SmileyPop 1.0版
9.3.1 检测碰撞和删除精灵
9.3.2 整合
9.4.本章小结
9.5 编程挑战
第10章 游戏编程
10.1 构建游戏框架——Smiley Pong 1.0版
10.1.1 绘制游戏板和游戏部件
10.1.2 记录分数
10.1.3 显示得分
10.1.4 整合
10.2 增加难度并结束游戏——Smiley Pong 2.O版
10.2.1 游戏结束
10.2.2 再玩一次
10.2.3 更快
10.2.4 整合
10.3 添加更多的功能——SmileyPop 2.0版
10.3.1 使用Pygame添加声音
10.3.2 跟踪和记录玩家进度
10.3.3 整合
10.4 本章小结
10.5 编程挑战
附录A Windows、Mac和Linux下的Python安装
A.1 Windows下安装Python
A.1.1 下载安装程序
A.1.2 运行安装程序
A.1.3 尝试Python
A.2 Mac下安装Python
A.2.1 下载安装程序
A.2.2 运行安装程序
A.2.3 尝试Python
A.3 Linux下的Python安装
附录B Windows、Mac和Linux下的 Pygame安装
B.1 在Windows下安装Pygame
B.2 Mac下安装Pygame
B.3 Linux下安装Pygame
附录C 构建自己的模块
C.1 构建colorspiral模块
C.1.1 使用colorspiral模块
C.1.2 重用colorspiral模块
C.2 附加资料
术语表
封底

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

教孩子学编程-Python语言版.pdf

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140.
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148.
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161.
  • 162.
  • 163.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 169.
  • 170.
  • 171.
  • 172.
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.
  • 178.
  • 179.
  • 180.
  • 181.
  • 182.
  • 183.
  • 184.
  • 185.
  • 186.
  • 187.
  • 188.
  • 189.
  • 190.
  • 191.
  • 192.
  • 193.
  • 194.
  • 195.
  • 196.
  • 197.
  • 198.
  • 199.
  • 200.
  • 201.
  • 202.
  • 203.
  • 204.
  • 205.
  • 206.
  • 207.
  • 208.
  • 209.
  • 210.
  • 211.
  • 212.
  • 213.
  • 214.
  • 215.
  • 216.
  • 217.
  • 218.
  • 219.
  • 220.
  • 221.
  • 222.
  • 223.
  • 224.
  • 225.
  • 226.
  • 227.
  • 228.
  • 229.
  • 230.
  • 231.
  • 232.
  • 233.
  • 234.
  • 235.
  • 236.
  • 237.
  • 238.
  • 239.
  • 240.
  • 241.
  • 242.
  • 243.
  • 244.
  • 245.
  • 246.
  • 247.
  • 248.
  • 249.
  • 250.
  • 251.
  • 252.
  • 253.
  • 254.
  • 255.
  • 256.
  • 257.
  • 258.
  • 259.
  • 260.
  • 261.
  • 262.
  • 263.
  • 264.
  • 265.
  • 266.
  • 267.
  • 268.
  • 269. 封面 书名 版权 前言 目录 第1章 Python基础——认识环境 1.1 认识Python 1.2 用Python编写程序 1.3 运行Python程序 1.4 本章小结 1.5 编程挑战 第2章 海龟作图——用Python绘图 2.1 第一个海龟程序 2.1.1 程序是如何工作的 2.1.2 发生了什么 2.2 旋转的海龟 2.3 海龟画圆 2.4 添加颜色 2.4.1 一个四色螺旋线 2.4.2 修改背景颜色 2.5 一个变量搞定一切 2.6 本章小结 2.7 编程挑战 第3章 数字和变量——用Python做数学运算 3.1 变量——保存内容的地方 3.2 Python中的数字和数学运算 3.2.1 Python数字 3.2.2 Python操作符 3.2.3 在Python shell中进行数学运算 3.2.4 语法错误——你说什么 3.2.5 Python shell中的变量 3.2.6 用操作符编程——比萨计算器 3.3 字符串——Python中真正的字符 3.4 用字符串改进彩色螺旋线 3.5 列表——将所有内容放到一起
  • 270. 3.6 Python做作业 3.7 本章小结 3.8 编程挑战 第4章 循环很有趣(你可以再说一遍) 4.1 构建自己的循环 4.1.1 使用for循环生成四个圆组成的玫瑰花瓣 4.1.2 修改循环让玫瑰花瓣带有6个圆 4.2 把玫瑰花瓣程序改进为允许用户输入 4.3 游戏循环和while循环 4.4 家庭成员螺旋线 4.5 整合——病毒式的螺旋线 4.6 本章小结 4.7 编程挑战 第5章 条件(如果是这样该怎么办?) 5.1 if语句 5.2 认识布尔值 5.2.1 比较操作符 5.2.2 你还不够大! 5.3 else语句 5.3.1 多边形或玫瑰花瓣 5.3.2 偶数还是奇数 5.4 elif语句 5.5 复杂条件——if、and、or和not 5.6 秘密消息 5.6.1 打乱字符串 5.6.2 字符的值 5.6.3 加密/解密程序 5.7 本章小结 5.8 编程挑战 第6章 随机的乐趣和游戏(继续前进,抓住机会!) 6.1 猜数字游戏 6.2 彩色的随机螺旋线 6.2.1 选取颜色——任意的颜色 6.2.2 获取坐标 6.2.3 画布有多大
  • 271. 6.2.4 整合 6.3 Rock-Paper-Scissors 6.4 选一张牌——任意一张牌 6.4.1 堆牌 6.4.2 发牌 6.4.3 计算牌面 6.4.4 继续前进 6.4.5 整合 6.5 掷骰子 6.5.1 设置游戏 6.5.2 对骰子排序 6.5.3 测试骰子 6.5.4 整合 6.6 万花筒 6.7 本章小结 6.8 编程挑战 第7章 函数(那些东西有了一个名字) 7.1 用函数整合内容 7.1.1 定义random_spiral() 7.1.2 调用random_spiral() 7.2 参数——传给函数 7.2.1 在随机位置微笑 7.2.2 整合 7.3 返回——发回统计结果 7.3.1 从函数返回一个值 7.3.2 在程序中使用返回值 7.4 交互简介 7.4.1 处理事件——TurtleDraw 7.4.2 监听键盘事件——ArrowDraw 7.4.3 用参数处理事件——ClickSpiral 7.4.4 更进一步——ClickandSmile 7.5 ClickKaleidoscope 7.5.1 draw kaleido()函数 7.5.2 draw_spiral()函数 7.5.3 整合
  • 272. 7.6 本章小结 7.7 编程挑战 第8章 定时器和动画 8.1 获取Pygame的所有GUI 8.1.1 Pygame画一个点 8.1.2 Pygame中的新内容 8.1.3 游戏的部分 8.2 时间刚刚好——移动和弹跳 8.2.1 移动笑脸 8.2.2 用Clock类实现笑脸动画 8.2.3 将笑脸从墙上弹开 8.2.4 在四面墙上弹回笑脸 8.3 本章小结 8.4 编程挑战 第9章 用户交互——进入游戏 9.1 增加交互——点击和拖动 9.1.1 点击点 9.1.2 拖动绘制 9.2 高级交互——笑脸爆炸 9.2.1 笑脸精灵 9.2.2 设置精灵 9.2.3 更新精灵 9.2.4 较大的和较小的笑脸 9.2.5 整合 9.3 SmileyPop 1.0版 9.3.1 检测碰撞和删除精灵 9.3.2 整合 9.4.本章小结 9.5 编程挑战 第10章 游戏编程 10.1 构建游戏框架——Smiley Pong 1.0版 10.1.1 绘制游戏板和游戏部件 10.1.2 记录分数 10.1.3 显示得分 10.1.4 整合
  • 273. 10.2 增加难度并结束游戏——Smiley Pong 2.O版 10.2.1 游戏结束 10.2.2 再玩一次 10.2.3 更快 10.2.4 整合 10.3 添加更多的功能——SmileyPop 2.0版 10.3.1 使用Pygame添加声音 10.3.2 跟踪和记录玩家进度 10.3.3 整合 10.4 本章小结 10.5 编程挑战 附录A Windows、Mac和Linux下的Python安装 A.1 Windows下安装Python A.1.1 下载安装程序 A.1.2 运行安装程序 A.1.3 尝试Python A.2 Mac下安装Python A.2.1 下载安装程序 A.2.2 运行安装程序 A.2.3 尝试Python A.3 Linux下的Python安装 附录B Windows、Mac和Linux下的 Pygame安装 B.1 在Windows下安装Pygame B.2 Mac下安装Pygame B.3 Linux下安装Pygame 附录C 构建自己的模块 C.1 构建colorspiral模块 C.1.1 使用colorspiral模块 C.1.2 重用colorspiral模块 C.2 附加资料 术语表 封底