Muutke küpsiste eelistusi

Python for Kids, 2nd Edition: A Playful Introduction to Programming [Pehme köide]

  • Formaat: Paperback / softback, 368 pages, kõrgus x laius: 234x177 mm
  • Ilmumisaeg: 15-Nov-2022
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1718503024
  • ISBN-13: 9781718503021
Teised raamatud teemal:
  • Formaat: Paperback / softback, 368 pages, kõrgus x laius: 234x177 mm
  • Ilmumisaeg: 15-Nov-2022
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1718503024
  • ISBN-13: 9781718503021
Teised raamatud teemal:
The second edition of the best-selling Python for Kids—which brings you (and your parents) into the world of programming—has been completely updated to use the latest version of Python, along with tons of new projects!

Python is a powerful, expressive programming language that’s easy to learn and fun to use! But books about learning to program in Python can be dull and gray—and that’s no fun for anyone.

Python for Kids brings Python to life and brings kids (and their parents) into the wonderful world of programming. Author Jason R. Briggs guides readers through the basics, experimenting with unique (and often hilarious) example programs that feature ravenous monsters, secret agents, thieving ravens, and more. New terms are defined; code is colored, dissected, and explained; and quirky, full-color illustrations keep things fun and engaging throughout.

Chapters end with programming puzzles designed to stretch the brain and strengthen understanding. By the end of the book, young readers will have programmed two complete games: a clone of the famous Pong, and “Mr. Stick Man Races for the Exit”—a platform game with jumps, animation, and much more.

This second edition has been completely updated and revised to reflect the latest Python version and programming practices, with new puzzles to inspire readers to take their code farther than ever before. Why should serious adults have all the fun? Python for Kids is the ticket into the amazing world of computer programming.

Arvustused

"A book designed to bring coding with Python to life for kids. . . . Briggs breaks down terminology into simple terms and offers explanations for what your child will be doing [ to] help them apply their skills to real-life situations." Amy Boyington, Parenting and Family Lifestyle Writer

If youre completely new to programming, this would be a fantastic book to get started with. The Security Noob

"Fun and effective, [ Python for Kids] is an ideal and unreservedly recommended addition to personal, family, middle school, high school, and community library Computer instructional reference collections." Midwest Book Review

Acknowledgments xxi
Introduction xxiii
Why Python xxiv
How to Learn to Code xxiv
Who Should Read This Book xxv
What's in This Book xxvi
Python for Kids Website xxvii
Have Fun! xxvii
PART I LEARNING TO PROGRAM
1(170)
1 Not All Snakes Slither
3(12)
A Few Words About Language
4(1)
Installing Python
5(5)
Installing Python on Windows
5(1)
Installing Python on macOS
6(1)
Installing Python on Ubuntu
7(1)
Installing Python on Raspberry Pi (Raspberry Pi OS or Raspbian)
8(2)
Once You've Installed Python
10(2)
Saving Your Python Programs
12(1)
What You Learned
13(2)
2 Calculations And Variables
15(10)
Calculating with Python
16(1)
Python Operators
17(1)
The Order of Operations
18(1)
Variables Are Like Labels
19(1)
Using Variables
20(3)
What You Learned
23(2)
3 Strings, Lists, Tuples, And Dictionaries
25(18)
Strings
26(1)
Creating Strings
26(1)
Handling Problems with Strings
27(2)
Embedding Values in Strings
29(1)
Multiplying Strings
30(2)
Lists Are More Powerful than Strings
32(2)
Adding Items to a List
34(1)
Removing Items from a List
35(1)
List Arithmetic
35(2)
Tuples
37(1)
Python Dictionaries
38(3)
What You Learned
41(1)
Programming Puzzles
41(2)
#1 Favorites
41(1)
#2 Counting Combatants
41(1)
#3 Greetings!
41(1)
#4 Multiline Letter
41(2)
4 Drawing With Turtles
43(12)
Using Python's Turtle Module
44(1)
Creating a Canvas
44(1)
Moving the Turtle
45(6)
What You Learned
51(1)
Programming Puzzles
51(4)
#1 A Rectangle
52(1)
#2 A Triangle
52(1)
#3 A Box Without Corners
52(1)
#4 A Tilted Box Without Corners
52(3)
5 Asking Questions With If And Else
55(14)
If Statements
56(1)
A Block Is a Group of Programming Statements
56(3)
Conditions Help Us Compare Things
59(1)
If-Then-Else Statements
60(1)
If and elif Statements
61(1)
Combining Conditions
62(1)
Variables with No Value--None
63(1)
The Difference Between Strings and Numbers
64(3)
What You Learned
67(1)
Programming Puzzles
67(2)
#1 Are You Rich?
67(1)
#2 Twinkies!
67(1)
#3 Just the Right Number
68(1)
#4 I Can Fight Those Ninjas
68(1)
6 Going Loopy
69(14)
Using for Loops
70(7)
While We're Talking About Looping
77(3)
What You Learned
80(1)
Programming Puzzles
80(3)
#1 The Hello Loop
80(1)
#2 Even Numbers
80(1)
#3 My Five Favorite Ingredients
81(1)
#4 Your Weight on the Moon
81(2)
7 Recycling Your Code With Functions And Modules
83(12)
Using Functions
84(1)
Parts of a Function
85(1)
Variables and Scope
86(3)
Using Modules
89(3)
The input function
92(1)
What You Learned
92(1)
Programming Puzzles
93(2)
#1 Basic Moon Weight Function
93(1)
#2 Moon Weight Function and Years
93(1)
#3 Moon Weight Program
93(1)
#4 Mars Weight Program
94(1)
8 How To Use Classes And Objects
95(20)
Breaking Things into Classes
96(1)
Children and Parents
97(1)
Adding Objects to Classes
98(1)
Defining Functions of Classes
99(1)
Adding Class Characteristics
99(2)
Why Use Classes and Objects?
101(2)
Objects and Classes in Pictures
103(3)
Other Useful Features of Objects and Classes
106(1)
Inherited Functions
106(2)
Functions Calling Other Functions
108(1)
Initializing an Object
109(2)
What You Learned
111(1)
Programming Puzzles
111(4)
#1 The Giraffe Shuffle
111(1)
#2 Turtle Pitchfork
112(1)
#3 Two Small Spirals
112(1)
#4 Four Small Spirals
113(2)
9 More Turtle Graphics
115(20)
Starting with the Basic Square
115(2)
Drawing Stars
117(4)
Drawing a Car
121(2)
Coloring Things In
123(1)
A Function to Draw a Filled Circle
124(2)
Creating Pure Black and White
126(1)
A Square-Drawing Function
127(1)
Drawing Filled Squares
128(2)
Drawing Filled Stars
130(2)
What You Learned
132(1)
Programming Puzzles
132(3)
#1 Drawing an Octagon
133(1)
#2 Drawing a Filled Octagon
133(1)
#3 Another Star-Drawing Function
134(1)
#4 Four Spirals Revisited
134(1)
10 Using Tkinter For Better Graphics
135(36)
Creating a Clickable Button
137(2)
Using Named Parameters
139(1)
Creating a Canvas for Drawing
139(1)
Drawing Lines
140(2)
Drawing Boxes
142(3)
Drawing a Lot of Rectangles
145(2)
Setting the Color
147(4)
Drawing Arcs
151(2)
Drawing Polygons
153(2)
Displaying Text
155(2)
Displaying Images
157(2)
Creating Basic Animation
159(3)
Making an Object React to Something
162(3)
More Ways to Use the Identifier
165(2)
What You Learned
167(1)
Programming Puzzles
167(4)
#1 Fill the Screen with Triangles
167(1)
#2 The Moving Triangle
167(1)
#3 The Moving Photo
167(1)
#4 Fill the Screen with Photos
167(4)
PART II BOUNCE!
11 Beginning Your First Game: Bounce!
171(14)
Whack the Bouncing Ball
172(1)
Creating the Game Canvas
172(2)
Creating the Ball Class
174(2)
Adding Some Action
176(7)
Making the Ball Move
176(3)
Making the Ball Bounce
179(1)
Changing the Ball's Starting Direction
180(3)
What You Learned
183(1)
Programming Puzzles
183(2)
#1 Changing Colors
183(1)
#2 Flashing Colors
183(1)
#3 Take Your Positions!
183(1)
#4 Adding the Paddle?
184(1)
12 Finishing Your First Game: Bounce!
185(16)
Adding the Paddle
186(1)
Making the Paddle Move
187(2)
Finding Out When the Ball Hits the Paddle
189(3)
Adding an Element of Chance
192(4)
What You Learned
196(1)
Programming Puzzles
197(4)
#1 Delay the Game Start
197(1)
#2 A Proper "Game Over"
197(1)
#3 Accelerate the Ball
197(1)
#4 Record the Player's Score
198(3)
PART III MR. STICK MAN RACES FOR THE EXIT
13 Creating Graphics For The MR. Stick Man Game
201(12)
Mr. Stick Man Game Plan
202(1)
Getting GIMP
202(2)
Creating the Game Elements
204(1)
Preparing a Transparent Image
205(1)
Drawing Mr. Stick Man
206(2)
Mr. Stick Man Running to the Right
207(1)
Mr. Stick Man Running to the Left
207(1)
Drawing the Platforms
208(1)
Drawing the Door
209(1)
Drawing the Background
210(1)
Transparency
211(1)
What You Learned
212(1)
14 Developing The Mr. Stick Man Game
213(20)
Creating the Game Class
214(1)
Setting the Window Title and Creating the Canvas
214(1)
Finishing the ___init___ Function
215(1)
Creating the mainloop Function
216(2)
Creating the Coords Class
218(1)
Checking for Collisions
219(1)
Sprites Colliding Horizontally
220(2)
Sprites Colliding Vertically
222(1)
Putting It All Together: Our Final Collision-Detection Code
223(2)
The collidedjeft Function
223(1)
The collided right Function
224(1)
The collided top Function
224(1)
The collided bottom Function
225(1)
Creating the Sprite Class
225(2)
Adding the Platforms
227(1)
Adding a Platform Object
228(1)
Adding a Bunch of Platforms
229(1)
What You Learned
230(1)
Programming Puzzles
231(2)
#1 Checkerboard
231(1)
#2 Two-Image Checkerboard
231(1)
#3 Bookshelf and Lamp
231(1)
#4 Random Background
232(1)
15 Creating Mr. Stick Man
233(10)
Initializing the Stick Figure
234(1)
Loading the Stick Figure Images
234(1)
Setting Up Variables
235(2)
Binding to Keys
237(1)
Turning the Stick Figure Left and Right
237(1)
Making the Stick Figure Jump
238(1)
What We Have So Far
239(2)
What You Learned
241(2)
16 Completing The Mr. Stick Man Game
243(28)
Animating the Stick Figure
244(1)
Creating the Animate Function
244(3)
Checking for Movement
244(2)
Changing the Image
246(1)
Getting the Stick Figure's Position
247(2)
Making the Stick Figure Move
249(8)
Starting the move Function
249(1)
Has the Stick Figure Hit the Bottom or Top of the Canvas?
250(1)
Has the Stick Figure Hit the Side of the Canvas?
251(1)
Colliding with Other Sprites
252(1)
Colliding at the Bottom
253(2)
Checking Left and Right
255(2)
Testing Our Stick Figure Sprite
257(1)
The Exit!
257(1)
Creating the DoorSprite Class
257(1)
Detecting the Door
258(1)
Adding the Door Object
259(1)
The Final Game
260(7)
What You Learned
267(1)
Programming Puzzles
268(3)
#1 `You Win!"
268(1)
#2 Animating the Door
268(1)
#3 Moving Platforms
268(1)
#4 Lamp as a Sprite
268(3)
AFTERWORD: WHERE TO GO FROM HERE
271(12)
Installing Python pip on Windows
272(1)
Installing Python pip on Ubuntu
273(1)
Installing Python pip on Raspberry Pi
273(1)
Installing Python pip on macOS
274(1)
Trying out PyGame
275(1)
Other Games and Graphics Programming
276(1)
Other Programming Languages
277(3)
JavaScript
277(1)
Java
278(1)
C#
278(1)
C/C++
278(1)
Ruby
279(1)
Go
279(1)
Rust
280(1)
Swift
280(1)
Final Words
280(3)
A Python Keywords 283(16)
B Python's Built-In Functions 299(24)
C Troubleshooting 323(4)
Index 327
Jason Briggs has been a programmer since the age of eight, when he first learned BASIC on a Radio Shack TRS-80. Since then he has written software professionally as a developer and systems architect and served as Contributing Editor for Java Developer's Journal. His articles have appeared in JavaWorld, ONJava and ONLamp.