Statistics
92
Views
4
Downloads
0
Donations
Support
Share
Uploader

高宏飞

Shared on 2025-11-11
Support Statistics
¥.00 · 0times
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

(This page has no text content)
(This page has no text content)
(This page has no text content)
Computer Coding for Kids An Educational Guide to Learn the Basics of Programming Language to Create your own Games while having fun Harvey Lukes © Copyright 2020 - All rights reserved. The content contained within this book may not be reproduced, duplicated or transmitted without direct written permission from the author or the publisher. Under no circumstances will any blame or legal responsibility be held against the publisher, or author, for any damages, reparation, or
monetary loss due to the information contained within this book, either directly or indirectly. Legal Notice: This book is copyright protected. It is only for personal use. You cannot amend, distribute, sell, use, quote or paraphrase any part, or the content within this book, without the consent of the author or publisher. Disclaimer Notice: Please note the information contained within this document is for educational and entertainment purposes only. All effort has been executed to present accurate, up to date, reliable, complete information. No warranties of any kind are declared or implied. Readers acknowledge that the author is not engaged in the rendering of legal, financial, medical or professional advice. The content within this book has been derived from various sources. Please consult a licensed professional before attempting any techniques outlined in this book. By reading this document, the reader agrees that under no circumstances is the author responsible for any losses, direct or indirect, that are incurred as a result of the use of the information contained within this document, including, but not limited to, errors, omissions, or inaccuracies.
Table of Contents Introduction About the Book Requirements Chapter 1: Getting Ready What Does It Mean to Code? Is Programming Hard to Learn? Is Programming That Important? What Languages Are the Best? HyperText Markup Language (HTML) Cascading Style Sheets (CSS) JavaScript Python C# Java C++ How Programs Work The Design Phase So Many Languages! Scratching that Coding Itch with Scratch Setting Up Hello, World! Slithering with Python From Scratch to Python Installing Python IDE Setup Notice the Colors Are You Ready? Chapter 2: Programming in Practice
Variables Note on Naming Conventions Project 1: Scratch Project 2: Python Program Structure and Flow Other Activities for Kids Understanding and Practicing Sequences Using Cards to Learn Algorithms Practice Conditional Statements in the Backyard Chapter 3: Learn, Program, Repeat Meet JavaScript Getting Started The HTML Foundation Embedding JavaScript Project 3: Hangman with JavaScript Make the Game More Challenging Help! I’m Stuck! Joining an Online Community Conclusion References
Introduction So you’re interested in coding and want to learn how to create computer software and games. Or maybe you want to learn how to code so that one day you can become a hacker (no, they’re not evil). In either case, you took the first step on your journey to become a programmer by picking up this book! Awesome! Programming isn’t just about writing boring code every day. It involves creativity and a love for solving puzzles. It can be used to create art, design websites, develop games, build graphical simulations, tell stories, and send ships into space. There’s something for everyone! Being able to code opens up a whole universe of possibilities, and this book is here to guide you and give you the tools you need to achieve your dreams. Throughout these pages, you’ll learn something new that you can share with your friends, family, and online communities of coders from around the world. It’s like entering a special club. What’s just as important, and probably the most important, is that you’ll finally be able to understand all the tech jokes you hear in movies. For instance, do you know what happened when the programmer’s wife sent him to the grocery store? She told him to buy a loaf of bread, and if they also had eggs, to buy a dozen. The programmer went to the store, doing as he was told, and he came back carrying a dozen loaves of bread and he told his wife, “Yup, they had eggs.” Don’t get it? Well, then you need to learn how to code! About the Book Interest in learning about technology and programming is higher than ever before, but few schools have started teaching kids coding classes. Most kids have to find a camp for young programmers, or
go take private lessons. But you don’t have to now, because you have this book to guide you and teach you the ways of the programmer. Computer Coding for Kids will give you all the basic tools and teach you the fundamentals you need to become a programmer. Everything you’ll learn in this book can be applied in the real world, no matter which programming language you’ll later choose to focus on. Here’s a breakdown of what you’re about to explore: 1. Programming fundamentals : Most programming languages are built on the same principles. This means that if you learn the basic concepts of coding, such as loops, conditionals, and functions, you’ll know how to use them whether you’re coding in Python, JavaScript, or C++. Mastering the fundamentals is the most important part of programming, even though at times it might seem boring because it involves a lot of theory. But by building a strong foundation, you’ll be able to do anything you want. You can become a game developer, a cybersecurity specialist, software engineer, data scientist, and so much more. 2. Scratch : This is one of the most popular programming learning tools developed at MIT. This is an ideal start for many young children that want to learn coding on their own or with the help of their parents and educators. Instead of focusing on writing complex lines of code, Scratch involves using language blocks. It’s kind of like playing with LEGO bricks and using your creativity to build something. This way, Scratch allows children to develop a logical way of thinking and solving problems, both of which are crucial skills in programming. In addition, Scratch also has an online community that can teach you how to work with others. 3. JavaScript : You’ll also have a taste of JavaScript, which is a language used to develop online applications and websites. Nowadays, this language allows you to jump in a lot easier than ever before because it allows you to also work with premade blocks, just like Scratch. But, you can
also switch to text mode and write the lines of code yourself once you become more familiar with programming concepts. 4. Python : Arguably one of the most versatile and powerful languages, Python is also one of the easiest to learn. Python is used for many things, including software development, game development, robotics, data science, machine learning, and much more. The reason for its popularity isn’t just because it can do practically anything, but because its language syntax is simple. Python is one of the few languages that’s very close to English. This makes it easy to understand just by learning the basic programming concepts and techniques. 5. Other languages : In addition to the above programming languages, you will also be introduced to other languages like Java and C#. Requirements Learning how to code and create software isn’t rocket science, but you still need to fulfill a set of requirements before getting started. So, here’s what you’re going to need: ● This handy programming guide. You’re already reading this, so that’s already off the checklist. Keep the book nearby at all times and revisit things you don’t remember or fully understand. Don’t worry if you don’t understand things perfectly. Programming is learned through practice, not just by reading books. ● A computer with an Internet connection. You probably already have this because it’s pretty difficult to start coding without a computer. Plus, you need to download some tools and do additional research or join communities for programmers. ● Computer basics. To learn how to program, you first need to be able to use a computer at least at a basic level. This means that you already played some computer games, used some
apps, and that you understand how to find your way around a user interface. ● Tolerate math. Many programming concepts actually come from mathematics. After all, you will have to perform some mathematical operations, logical operations, or just work with numbers in general. You don’t have to like math, but you need to be willing to learn some. Don’t worry if you think you’re bad at it because a lot of beginner programmers actually find it much easier to learn math through coding examples than through a teacher that’s trying to shove math in their brains. ● Attention to detail. Programming is all about solving problems. This means you need to be able to focus on the problem and be patient enough to try out all of your ideas. When something doesn’t work, it’s usually because of a simple mistake that could’ve been avoided, like misspelling a keyword or forgetting to close a bracket. Above all, you need to be motivated and have fun! Learning how to code doesn’t have to be a long, boring process. It can be fun and exciting! Programming involves a lot of creativity, so use yours and figure out what’s fun for you. Some find it fun to create games. After all, it’s satisfying to see a character move and shoot something at a monster after writing code for a few hours. That dose of fun is your reward. Others love solving puzzles, so fixing errors and bugs will give them a thrill like nothing else. Programming has something for everyone, so let’s get started!
Chapter 1: Getting Ready Right now, the only thing you’re probably sure of is that programming languages are used to create applications and games. But how does it work? What does it actually mean to code something? Let’s put some training wheels on our bikes first and learn what programming is, before developing the next Minecraft. What Does It Mean to Code? Coding, or programming, simply means that we are writing a set of commands to tell the computer what to do. Computers aren’t like people. They don’t talk like we do. They have their own language, but it’s very difficult for us to use it. That language is known as machine code. Computers communicate in binary (in 1s and 0s) and
while we can learn that language as well, it’s incredibly tedious for us to work with, not to mention boring and easy to mess up. That’s why we use programming languages like Python and C++. These languages are closer to English and much easier for us to understand and work with. But the computer still doesn’t quite understand these languages. They need to be translated to machine code, and that’s what interpreters, code compilers, and assemblers are for. So in other words, coding just means speaking to machines. It’s like picking up a second language, like German or Italian, so that others who don’t speak English can understand you. Is Programming Hard to Learn? This is probably one of the first questions on your mind, and the simple answer is no. Anyone can learn how to code. That’s why more and more schools are starting to teach programming lessons to kids as young as 8! You don’t need special talents for this. It’s like learning how to ride a bike. You hop on, you wobble a little, use some training wheels maybe, and before you know it, you’re mountain biking! Modern programming languages like Python are designed for us more than for the computers. You can probably already understand code that’s written in Python because most of its keywords are plain English words. Code doesn’t look like it does in the Matrix or other movies where they show long rows of code filled with weird sequences of numbers, letters, and symbols. It just looks like this: print (‘I love coding!’) Doesn’t look all that exciting anymore, right? That’s because programming is just a way for us to talk to the computer. But, that doesn’t mean you can’t make anything cool. In fact, you can learn how to make cool games and apps quite early. You don’t have to wait until you master a language.
Is Programming That Important? To answer that question, just look around you. How many gadgets and electronics do you have in your home? Chances are you have a computer, a smartphone, and maybe even a tablet. What else can you think of? Do you have a washing machine and a fridge? Does your home have a thermostat that automatically controls the temperature in your house? All of these objects have been programmed by someone to do the things they do. So to answer your question, yes, programming is becoming the equivalent of what reading and writing used to be hundreds of years ago. It’s becoming a necessary skill that can almost guarantee you a good job, or it can at least train your mind to be sharp. Learning from a young age is better than learning once you get older because right now, your brain is like a sponge. Programming languages are almost like normal languages and they’re much easier to absorb early on. Just think of the older people that constantly struggle with smartphones and other technologies, while for you it feels natural to use them. They’re probably already asking you to help them out. What Languages Are the Best?
This is probably your next big question. Every beginner spends far too much time asking what language is the best. There is no such thing. All languages are useful in various fields and for certain types of projects. It depends on the programmer’s preference and the nature of the application. The best language is the one you know best. Once you learn a language, no matter which one, together with the basic concepts of programming, you’ll be able to pick up other languages in no time. Many of them are very similar, but others are used only in specific areas, like website development. So, let’s go through some of them to give you an idea of what’s out there.
HyperText Markup Language (HTML) This is the language that stands at the base of all websites. It’s probably the easiest you can learn. Its purpose is to allow us to navigate on the Internet by using web links, also known as hyperlinks, so that we can find all the pages we’re interested in. The reason it’s called “hyper” is because you don’t have to do anything in a certain order. You just click on a link and it takes you to some far, distant corner of the Internet. But this language is a markup language. Don’t tell any programmer that you’re an HTML programmer, otherwise you’re going to make them mad. Yes, it’s a language that involves writing some code, but it’s not actually programming anything. HTML works by marking data with tags. These tags describe what the information is for and where it goes on the webpage. Your browser, like Firefox or Chrome, reads the tags and understands where to look for everything, like text paragraphs, images, and headings. HTML simply talks to the browser and tells it how the page works. But none of this is programming. Here’s an example of HTML code: <!DOCTYPE html> <html> <body> <h1> The text here is heading 1> <h4> The text here is heading 4> </body> </html> All this code does is mark the text so that the browser interprets it in the appropriate headings we want. So, we’re using HTML to create the skeleton of a website.
As a markup language, HTML doesn’t have any programming logic. In other words, we can’t make a smart program with it because it doesn’t contain any conditional statements, it can’t compare values to each other, and can’t handle any math or tasks. HTML can’t even figure out what 2+2 is because that’s not its purpose. If you’re interested in web design or website development, HTML is crucial because it forms the frame of the website. But alone, it’s not enough. To create a website, you need multiple tools and languages, such as CSS, which is used to make the website beautiful with graphics and animations, and actual programming languages that add some logic, like JavaScript or PHP. Cascading Style Sheets (CSS) Focus on the word “Style.” As we mentioned above, HTML builds the structure of a website. An empty structure is just ugly to look at. Just imagine concrete buildings with no paint and finishing touches. CSS is needed in web development to define the style of a webpage’s layout, its colors, text fonts, special effects, and much more. Let’s think of an example. Here’s a paragraph of text declared in HTML: <p> All code is beautiful </p> The ‘p’ at the beginning is used to mark where the paragraph starts and the ‘/p’ at the end tells the browser that the paragraph ends. But all we have right now is a boring paragraph. So, to spice things up a little, we’re going to apply some CSS code, which looks like this: p { color: red; font-weight:bold; } In this line of code, the ‘p’ refers to the paragraph, just like in HTML. It’s used to tell CSS that we want to beautify the paragraph. Afterwards, we have some information inside the curly braces, which is called a declaration. This is where we add properties like background color, font size, margins, and anything else you can think of. In this case, we’re making that HTML paragraph red instead of the default black, and we want it to be bolded instead of just plain.
As you can see, HTML builds the house, and CSS paints it, adds pretty tiles, windows, and makes it nice to live in. But CSS is still not a solid programming language because, like HTML, it just works with style information and not logic and behavior. These two languages are known in the web design business as front end languages, because they create the visual part of a page or online app. JavaScript The final piece of the puzzle when it comes to web development is JavaScript (not to be confused with Java). This programming language works with all web browsers and it’s used to add functionality to a website. While some programmers like to argue that it’s still not a true programming language, calling it a scripting language, they’re partially wrong. It’s a language that differs from the traditional C++ you’ve probably heard of, because it runs straight inside the web browser. JavaScript is used together with HTML and CSS to create online applications and websites because it allows the developer to control the functionality. Remember that HTML builds the foundation, CSS makes it pretty by adding windows and a few layers of paint, but JavaScript is needed to create all the stuff you interact with. For example, we use it to create buttons, to control media like videos, and to deal with password forms when setting up user accounts. With that in mind, here are some of the things JavaScript can do: 1. Create variables and store information inside them. 2. Define functions, classes, and objects (more on this later). 3. Use modules. 4. Create events that are triggered on click. These are just some of the basics, but to sum it all up, JavaScript handles all the logic programming, like other standard programming languages such as Python. This means you can perform mathematical calculations, which HTML and CSS can’t, as well as comparisons and conditional operations.
Python This language is one of the top choices for beginner programmers, as well as experienced ones like data scientists. Python is fast to learn, easy to use, versatile, and powerful, making it one of the best all-around options when entering the world of programming. Some schools are even starting to teach it to kids as young as 8! One of the main reasons why it’s recommended for you to go with Python is simply the fact that it’s readable. This language is as readable as English because it’s basically English. Just for the sake of comparison, check out the difference between Python and another popular language called Java: public class Main { public static void main (strings [] args) { System.out.printIn (“Hello, world!”) } } This example is in Java. You probably don’t understand much, right? All the program does is print the “Hello, world!” message on your computer screen. That’s quite a lot of code just for that, isn’t it? Plus it’s quite a mouth full and hard to read. Well, here’s how this same code looks like in Python: print (“Hello, world!”) And that’s it! No need for any fancy keywords and symbols that don’t make much sense to a beginner. You can already understand what’s going on, even without any or very little programming knowledge. You have a print command that does what it says. It prints some words on your screen. Simple, efficient, and easy to work with. Another important reason why Python should be on your list is the access to the many online communities of Python programmers. You’ll soon find out that working with others is a lot easier than creating something on your own. You need help every now and then,
and programming with other coders can teach you a lot. Python’s worldwide popularity means that there are massive amounts of online resources to learn from and a lot of communities ready to answer your questions. No matter how many books you read and how many lessons you take, you’ll be stuck with a problem you can’t solve. This is when others can come to the rescue and offer you some ideas or solutions you never thought about. This is how you learn to become a better programmer. As for its versatility, Python isn’t just a learning language for beginners. Python is flexible and can be used for many applications. Many modules and libraries have been created to expand the language and improve it so it can be used in a variety of fields. This means that by learning Python now at a young age, you’ll already be set up for a career once you grow up. It has everything you need to create games with the help of the PyGames engine, or create applications, or even start programming robots. Python is often used to build intelligent devices, like home security systems. On top of that, with the amount of data the world generates, Python is now being used to analyze it. So if one day you want to work with information, you can use your Python skills to become a data scientist, data analyst, or a machine learning expert. C# This is another language that is used somewhat like Python. It’s not quite as easy to learn, but if you start out with Python first, you’ll have an easy time learning C#. C# is also close to English, but it usually requires more lines of code to do the same thing you do in Python (sort of like Java). So, why are we even talking about this language? C# is often used to develop apps, and it’s currently very popular with indie game developers. It’s a powerful language that goes hand in hand with the Unity game engine, which you can use for free. But this isn’t something you learn in a few days.