16,99 €
It's never too early to learn how to code!
Coding For Kids For Dummies helps you learn the basics of coding the fun way. This book walks you through the essentials of coding with 13 exciting projects. You'll learn what coding is, how to make digital toys and games on your computer, and how to start writing your first lines of code! With step-by-step instructions and activities, this book makes it simple to get started. And when you see error messages, don't panic! All new coders make mistakes—this book helps you figure them out and fix them, so your code will be good to go. Along the way, you'll be boosting your creativity, getting better at logical thinking, and learning a skill that will open the door to fun hobbies and careers. So get coding!
Kids who want to learn how to code (and the parents who want to encourage them) can get off to a great start with Coding For Kids For Dummies.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 305
Veröffentlichungsjahr: 2025
Cover
Table of Contents
Title Page
Copyright
Introduction
About This Book
Foolish Assumptions
Icons Used in This Book
Beyond the Book
Where to Go from Here
Part 1: Getting Started
CHAPTER 1: Seeing the Big Picture in Coding
What Is Coding?
Why Learn to Code?
Is It Hard to Code?
What Can You Make with Code?
What Languages Will You Use?
What’s a Program?
What’s an Algorithm?
Show Your Algorithm, Unplugged
CHAPTER 2: QuickStart Coding
Preparing Yourself to Code
A Hello World! Example
Things You’ll See in a Program
Writing a Program: Three Key Processes
Setting Up Block and Text Coding
Commenting Code
Fixing Mistakes (Debugging)
Debugging Scratch Programs
Debugging Text-Based Code
Part 2: Clicks, Moves, Loops, and a Little Logic
CHAPTER 3: Inputting and Outputting
Brainstorm
Start a New Project
Set Up the Stage
Set Up the Letter Sprites
Set Up the Character Sprite
Save, Test, and Debug Your Program
Enhance Your Program
CHAPTER 4: Moving and Looping
Brainstorm
Start a New Project
Set Up the Stage
Set Up the Rocket Sprite
Save, Test, and Debug Your Program
Enhance Your Program
CHAPTER 5: Animating with Simple Conditionals
Brainstorm
Start a New Project
Set Up the Stage
Set Up the Ghost Sprite
Set Up the Building Sprite
Duplicate to Make More Building Sprites
Save, Test, and Debug Your Program
Enhance Your Program
Part 3: Random Surprises and Functions
CHAPTER 6: Adding Randomness
Brainstorm
Start a New Project
Set Up the Stage
Set Up the Coin Sprite
Save, Test, and Debug Your Program
Enhance Your Program
CHAPTER 7: Writing Functions and Scattering Stuff
Brainstorm
Start a New Project
Set Up the Stage
Set Up the Pufferfish Sprite
Set Up the Pufferfish Clones
Save, Test, and Debug Your Program
Enhance Your Program
Part 4: Getting Gamey with Key Controls and Variables
CHAPTER 8: Creating a Reaction Game with Variables
Brainstorm
Start a New Project
Set Up the Variable
Set Up the Stage
Set Up the Porcupine Sprite
Set Up the Porcupine Clones
Save, Test, and Debug Your Program
Enhance Your Program
CHAPTER 9: Creating a Sports Game with Key Control
Brainstorm
Start a New Project
Set Up the Variables
Set Up the Stage
Set Up the Paddle Sprite
Set Up the Ball Sprite
Save, Test, and Debug Your Program
Enhance Your Program
CHAPTER 10: Creating a Collection and Avoidance Game
Brainstorm
Start a New Project
Set Up the Game Variables
Set Up the Stage
Set Up the Planet Sprite
Set Up the Astronaut Sprite
Set Up the Gem Sprite
Set Up the Robot Sprite
Save, Test, and Debug Your Program
Enhance Your Program
Part 5: Searching, Sorting, Logic, and Lists
CHAPTER 11: Working with Lists, Strings, and Text I/O
Brainstorm
Start a New Project
Set Up the Lists and Variables
Set Up the Stage
Set Up the Waffle Truck Sprite
Save, Test, and Debug Your Program
Enhance Your Program
CHAPTER 12: Searching and Logic
Brainstorm
Start a New Project
Set Up the Lists and Variables
Add the Text-to-Speech Extension
Set Up the Stage
Set Up the Frog Sprite
Save, Test, and Debug Your Program
Enhance Your Program
Part 6: Next Generation Coding
CHAPTER 13: Working with AI as Your Coding Sidekick
How Does AI Work?
How Can AI Support Me in Coding?
Getting Started with Machine Learning for Kids
Training a New ML Model
Learning and Testing with Your ML Model
Making Programs with Your ML Model
CHAPTER 14: Building AI Models
Brainstorming Machine Learning Image Models
Gathering Images for Training
Building Your Image Model in ML4K
Coding Your ML-powered Program in Scratch
Set Up the List and Variable
Add the Text-to-Speech Extension
Set Up the Pico Sprite
Save, Test, and Debug Your Program
Build New ML Models and Programs
Appendix: Joining the Coding Community
Sparking Program Ideas
Sharing and Showcasing Your Work
Index
About the Author
Connect with Dummies
End User License Agreement
Chapter 1
Table 1-1 Symbols Used In Flowcharts
Chapter 5
Table 5-1 Scratch Selection (Conditional) Commands
Chapter 1
FIGURE 1-1: Robots use code and AI to do their jobs.
FIGURE 1-2: A visual representation of a common bike-riding algorithm.
FIGURE 1-3: The bike-riding algorithm in Scratch code.
FIGURE 1-4: Flowchart of a homework algorithm.
Chapter 2
FIGURE 2-1: Hello World! in block-based code.
FIGURE 2-2: Hello World! in text-based code.
FIGURE 2-3: A sequence of commands executes in order.
FIGURE 2-4: The repeat command makes a section of code loop.
FIGURE 2-5: This conditional command selects whether Scratch Cat goes straight ...
FIGURE 2-6: The Scratch IDE.
FIGURE 2-7: Trinket site where you can try text-based coding.
Chapter 3
FIGURE 3-1: A new, untitled project in Scratch.
FIGURE 3-2: Choose a Backdrop.
FIGURE 3-3: The Slopes backdrop appears on the stage.
FIGURE 3-4: The Scratch sound library.
FIGURE 3-5: The Chill sound in the Sound Editor.
FIGURE 3-6: The complete code on the stage.
FIGURE 3-7: The Scratch sprite library.
FIGURE 3-8: The letter sprite with its two code sequences.
FIGURE 3-9: Duplicating a sprite.
FIGURE 3-10: Icons for all the letter sprites in the Sprite area.
FIGURE 3-11: Searching for a dog sprite in the sprite library.
FIGURE 3-12: Use the Fill tool to recolor areas on the dog.
FIGURE 3-13: Use the Paintbrush to draw pointy ears.
FIGURE 3-14: The complete code for the dog sprite.
Chapter 4
FIGURE 4-1: Adding a space-themed backdrop to the stage.
FIGURE 4-2: The Space Noise sound is added to the stage.
FIGURE 4-3: Green flag code on the stage.
FIGURE 4-4: Delete the other rocket sprite costumes to leave these two.
FIGURE 4-5: Setting the direction and rotation type of the rocket sprite.
FIGURE 4-6: Setting the size and finding the x and y coordinates of the rocket ...
FIGURE 4-7: Green flag code for the rocket sprite.
Chapter 5
FIGURE 5-1: Paint a backdrop to display on the stage.
FIGURE 5-2: Paint a backdrop with a black sky, green grass, and gold stars.
FIGURE 5-3: The complete code on the stage.
FIGURE 5-4: Setting the attributes in the Sprite area of the ghost sprite.
FIGURE 5-5: Green flag code for the ghost sprite.
FIGURE 5-6: Setting the attributes in the Sprite area of the building sprite.
FIGURE 5-7: The green flag code for the building sprite.
FIGURE 5-8: Duplicating the first building sprite.
FIGURE 5-9: Many duplicated building sprites create a cityscape.
Chapter 6
FIGURE 6-1: Paint a backdrop to display on the stage.
FIGURE 6-2: Paint a simple, solid color backdrop.
FIGURE 6-3: Selecting a coin face image from the web.
FIGURE 6-4: Saving a coin face image to your computer.
FIGURE 6-5: Upload a Sprite icon.
FIGURE 6-6: Navigate to a saved coin image.
FIGURE 6-7: Rename the sprite in the sprite Name field.
FIGURE 6-8: Upload another costume for your sprite.
FIGURE 6-9: Rename the costumes in each Costume Name field.
FIGURE 6-10: The complete Coin Flip code.
Chapter 7
FIGURE 7-1: Adding an ocean backdrop to the stage.
FIGURE 7-2: Green flag code on the stage.
FIGURE 7-3: The pufferfish sprite has four costumes.
FIGURE 7-4: Adding a new function to your program.
FIGURE 7-5: The newly added function command and function definition header.
FIGURE 7-6: Green flag code for the pufferfish sprite.
FIGURE 7-7: Green flag code and the
cloneAndScatter
function definition for the...
FIGURE 7-8: The
when I start as a clone
code on the pufferfish sprite.
FIGURE 7-9: The
when I start as a clone
code and the
floatAndPuff
function code...
FIGURE 7-10: The complete code for the pufferfish sprite.
Chapter 8
FIGURE 8-1: The newly added variable and associated commands.
FIGURE 8-2: Adding a backdrop to the stage and renaming it.
FIGURE 8-3: The complete green flag code on the stage.
FIGURE 8-4: Porcupine sprite added to the game.
FIGURE 8-5: Green flag code and the
cloneAndScatter
function definition for the...
FIGURE 8-6: The first
when I start as a clone
code and the
popUp
function code ...
FIGURE 8-7: The second
when I start as a clone
code and the
poke
function code ...
FIGURE 8-8: The complete code for the porcupine sprite.
Chapter 9
FIGURE 9-1: Adding and editing three backdrops for the stage.
FIGURE 9-2: Green flag code on the stage.
FIGURE 9-3: Adding a paddle sprite and editing its color.
FIGURE 9-4: The complete code for the paddle sprite.
FIGURE 9-5: The ball sprite added to the game, with its sprite name edited and ...
FIGURE 9-6: Creating a new function and function definition header.
FIGURE 9-7: Green flag code for the ball sprite.
FIGURE 9-8: Function definition for
moveAndBounce
.
FIGURE 9-9: Function definition for
checkHit
.
FIGURE 9-10: Function definition for
checkMiss
.
FIGURE 9-11: The complete code for the ball sprite.
Chapter 10
FIGURE 10-1: Green flag code on the stage.
FIGURE 10-2: The planet sprite added to the scene.
FIGURE 10-3: The green flag code for the planet.
FIGURE 10-4: The astronaut sprite added to the scene.
FIGURE 10-5: The complete code, both green flag and key control code, for the a...
FIGURE 10-6: The gem sprite added to the scene.
FIGURE 10-7: Creating a
chaseAstronaut
broadcast in New Message.
FIGURE 10-8: The green flag code for the gem sprite.
FIGURE 10-9: The robot sprite added to the scene.
FIGURE 10-10: The complete code for the robot sprite.
Chapter 11
FIGURE 11-1: Adding a new list variable,
candyList
, to your program.
FIGURE 11-2: The
candyList
and
fruitList
list variables on the stage.
FIGURE 11-3: Adding a
candyChoice
variable.
FIGURE 11-4: Importing a sound from the web.
FIGURE 11-5: The crowd noise sound on the stage.
FIGURE 11-6: The complete code for the stage.
FIGURE 11-7: The waffleTruck sprite added to the scene.
FIGURE 11-8: Complete
when this sprite clicked
code for the waffleTruck sprite.
Chapter 12
FIGURE 12-1: Adding a
guessList
list variable to your program.
FIGURE 12-2: Adding a
secretNum
variable.
FIGURE 12-3: Choose an Extension dialog box.
FIGURE 12-4: Creating the
checkGuess
function call.
FIGURE 12-5: Green flag code for the frog.
FIGURE 12-6: The complete
checkGuess
function code for the frog.
FIGURE 12-7: The complete code for the binary search number guess program in Sc...
Chapter 13
FIGURE 13-1: Training a machine learning model at
Code.org
.
FIGURE 13-2: Asking ChatGPT to help you write a code snippet.
FIGURE 13-3: Start a new machine learning project page.
FIGURE 13-4: Your machine learning projects page.
FIGURE 13-5: The named project page where you can train, test, and make things ...
FIGURE 13-6: Adding a label to train your machine learning model.
FIGURE 13-7: Adding an example to a label.
FIGURE 13-8: Labels complete with lots of text examples.
FIGURE 13-9: Scratch program using the Seasons ML text model.
FIGURE 13-10: Response based on text recognition by the ML model.
Chapter 14
FIGURE 14-1: Create folders on your computer to save and organize images for yo...
FIGURE 14-2: Start a new machine learning recognizing images project.
FIGURE 14-3: Color labels and examples.
FIGURE 14-4: Testing new data with the machine learning model.
FIGURE 14-5: The stage showing the Pico sprite, variable, and list variable.
FIGURE 14-6: The complete Scratch code for Pico's Colors.
FIGURE 14-7: The complete image recognition toy powered by machine learning.
Cover
Table of Contents
Title Page
Copyright
Begin Reading
Appendix: Joining the Coding Community
Index
About the Author
iii
iv
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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
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
270
271
272
273
274
275
276
277
278
279
Coding for Kids For Dummies®, 3rd Edition
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2026 by John Wiley & Sons, Inc. All rights reserved, including rights for text and data mining and training of artificial technologies or similar technologies.
Media and software compilation copyright © 2026 by John Wiley & Sons, Inc. All rights reserved, including rights for text and data mining and training of artificial technologies or similar technologies.
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4470, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
The manufacturer’s authorized representative according to the EU General Product Safety Regulation is Wiley-VCH GmbH, Boschstr. 12, 69469 Weinheim, Germany, e-mail: [email protected].
Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. CERTAIN AI SYSTEMS HAVE BEEN USED IN THE CREATION OF THIS WORK. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit https://hub.wiley.com/community/support/dummies.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2025945495
ISBN 978-1-394-35976-9 (pbk); ISBN 978-1-394-35978-3 (ePDF); ISBN 978-1-394-35977-6 (ePub)
So you want to learn to code! Coding — writing computer programs — has something for everyone: creativity, logic, art, math, storytelling, design, and problem solving. From toys and games to animations and simulations, this book coaches you step by step through coding real programs in real programming languages that you can share with family and friends.
Many kids want to learn to code, but not all kids have computer programming classes at school or a camp they can attend during the summer. That’s where this book comes in!
Coding for Kids For Dummies will help you learn all of the basic coding concepts and skills used by real computer programmers. Everything you do here will be useful in learning new skills and more advanced programming languages in the future. Best of all, the tools in this third edition are free, online, and easy to use.
This edition of the book covers the following:
Scratch,
a learning language created at MIT that is arguably the most popular kid programming language available. This book features projects in the most recent version of Scratch — Scratch 3.0. Scratch is a free, block-based language that offers new coders an easy entry into computer programming.
Python,
a text-based language that is used in creating video games, training robots, and even making artificial intelligence (AI) chatbots. In this book, text-based Python projects are shown in Trinket. The free Trinket online platform uses a web-based editor that runs a version of Python. It supports many core features of Python 3, especially those used in education, but not all Python 3 features are supported.
Artificial intelligence,
through Machine Learning for Kids (ML4K), a beginner-friendly platform that lets you train your own computer models to recognize images, text, and more — and then use those models in Scratch programs you create.
Foundational computer programming concepts,
which apply to both the projects in this book and any other coding (and, more generally, computer science) work you might pursue in the future.
Additionally, graphic design, sound editing, and animation are incredibly important skills that go hand in hand with coding to create great-looking and easy-to-understand digital tools. Although this book provides a little bit of guidance in these areas, the main focus of the content in these pages is coding.
Hello, person buying this book and reading this introduction! I assume you are a kid who wants to learn to code. Awesome! You are starting on an adventure that will take you from being a user of technology to being a maker of technology. And it’s a lot easier than you might think.
Here are a few other assumptions I make about you (or your technology) as you get started:
You are comfortable typing on a tablet or a computer and using a mouse or touchpad. Your experience can be either on a Windows or Mac system because instructions for coding each project are platform independent.
You have an Internet connection and know how to open a web browser to access websites.
You’ve played with a few apps, websites, or games on a computer, so you have some idea of what user interfaces (UI) look like and how people interact with a computer via the UI.
You’re comfortable with basic math, math operations such as adding whole numbers, and logical operations such as comparing two whole numbers. I introduce algebraic variables in this book — you don’t need to have any prior knowledge of variables.
Lastly, if you struggle with spelling and punctuation (and you’re operating in text-based mode), you may need to spend extra time troubleshooting your code for misspellings.
As you work through the projects in this book, you’ll see four icons. These icons point out different things.
The Tip icon gives you a tip that you can use to make your work easier. You’ll see some tips over and over again.
The Remember icon helps you remember and connect the coding concepts and skills you’re working on with the big ideas of coding!
The Warning icon tells you to watch out! It marks important information that may save you headaches.
The Technical Stuff icon lets you know more about the nuts and bolts of technical details and hardware help.
On the Dummies.com website, I give you some extra goodies that you won’t find in this book. Go to www.dummies.com and search for “Coding for Kids For Dummies Cheat Sheet” for a cheat sheet that summarizes the absolute basics of coding in Scratch, Python, and Machine Learning for Kids. Download the information, print it, and keep it with your computer!
It’s a good idea to work on the projects in order, but you can choose to jump around if you want to do so. After you gain a little experience coding, you can go in many new directions. Learn more advanced concepts in Scratch and Python. Make up your own projects and supercharge them with AI through Machine Learning for Kids. Work on learning more advanced programming languages. Learn to write control code for small electronic devices.
I hope this book inspires you to continue learning more about coding and making things with tech. Kudos on taking the first step! Now go get started!
Part 1
In this part you’ll …
Discover the components of a computer program
Explore the basics of using Scratch and Trinket
Gain strategies for fixing code when things go wrong
