Coding Basics for Kids: No Computer Needed

Teaching Kids Coding Basics is ... Basic

You don't need a fancy computer or fancy app, or any technology to start teaching kids basic coding. All you need is an understanding of how coding and programming work. In this post, we take a look at how parents and educators can teach kids coding without a computer, and you don't need to be a tech genius to do it. We will run through all the basics of coding and show you how they can be applied to teach kids.

Please feel free to share this post. We are very passionate about teaching kids STEM and especially concepts like coding and programming. I personally have been programming for over 15 years and can attribute a lot of success in my life to coding and problem-solving.

Why Teach Kids To Code?

We are currently writing an in-depth article on why kids should learn to code, and when we publish it, we will link it here for you. In the meantime, here are a few excellent reasons why you should teach your kids to code:

Problem Solving: Coding is logical, and it teaches kids to create solutions in a step by step manner.

Logical Thinking: There is no grey area in code; it is a series of logical steps. Coding teaches kids to think logically, which will help them in all facets of life.

Career Benefits: Coding is no longer a job title of its own. Many jobs require people to code. Kids that code will have many job opportunities when they get older.

Fun & Satisfying: Once kids learn the basics of code, they get to move on to creating apps and building things which is not only fun but very satisfying for kids.

There are so many more reasons why you should teach kids to code. We just can't cover them all here. Subscribe to ensure you don't miss out on future kids coding posts.

What Is Coding?

Before you can teach code to your kids, you probably want to know what coding is yourself. Once you understand it, then you can start by teaching kids what coding is.

Coding is simply a set of instructions given to a computer/processor.

To get the computer code onto a computer, you will need to use a programming language.

Programming Language

Computers use their own language. It is called Machine Code. Machine code is complex and does not make a lot of sense to us humans. You could learn machine code, but it would take you a very long time and will be very difficult.

To make coding a computer chip easier, we use 'Programming Language'. Which is a program that acts as an interpreter. It takes something that we can easily write and turns it into machine code for the computer to understand. This process is called 'Compiling'. There are thousands of different programming languages, and a handful of these are widely used languages. All do the same job, but the code that you write will be slightly different for each.

Here is an example of something kids would input vs what the computer processor needs to read. You will notice they are very different.

Here is a small piece of computer code that a user could type using the computer language 'Python'. It instructs the machine to print the words 'Hello World' onto a screen:

print("Hello World")

When you save that code and upload it to the computer processor, the Python program converts (compiles) it into Machine Language which looks like this:

b8 21 0a 00 00

a3 0c 10 00 06

b8 6f 72 6c 64

a3 08 10 00 06

b8 6f 2c 20 57

a3 04 10 00 06

b8 48 65 6c 6c

a3 00 10 00 06

b9 00 10 00 06

ba 10 00 00 00

bb 01 00 00 00

b8 04 00 00 00

cd 80

b8 01 00 00 00

cd 80

You can now see why users need to use a programming language. It is far easier to give a simple human instruction rather than type out the machine code.

Coding Basics For Kids

Now that you have a basic understanding of coding, and how a programming language works, let's take a look at some basic coding concepts that are available on almost every programming language.

Run

The first step in all computer coding is to 'Run' the program. It just means to start. There is no code needed for this; it is just basically turning on the code. For example, this usually occurs when you turn on your computer or turn on a toy that has a computer chip. When code is 'Run' it starts at the top and processes one line at a time. It is very fast though and can process hundreds of lines in milliseconds.

Instructions

Instructions are not a specific piece of code, but rather a fundamental instruction. An 'instruction' might be to power a motor or calculate something. It tells the computer to do a straight forward task.

Just like the example above, here is a simple instruction that tells the computer to print a line of text.

print("Hello World")

If

Typically known as an 'If Statement'. This is where you can only run a section of code only when certain rules are met. Probably one of the most common pieces of code used.

For example: Let's say you are writing a maths app. You ask a question, the user types an answer, and you display the result.

In the code below, 'user_answer' is the name (variable) we have given the number that the user types in. We then use an if statement to check if they typed in the correct answer, and, if they did we print 'You Are Correct!' to the screen.

user_answer = input("What is 2 + 2?") if user_answer == 4:

print('You Are Correct!')



If statements are not just used to compare math answers, think of them as questioning the current status. You use them when you want the machine to do something, but only IF conditions are met.

Else

The next most popular coding instruction is 'Else', and it is related to the if statement above. The else statement is the alternative to if.

Let's stick to the same example above: You are writing a maths app. You ask a question, the user types an answer, and you display the result.

In the code below, once again, we use 'user_answer' as the input given to us by the user. We use an if statement to check the answer. If the answer is correct, we print 'You Are Correct!', but if the 'user_answer' is incorrect, we display 'Sorry, Try Again.'.

user_answer = input("What is 2 + 2?") if user_answer == 4:

print('You Are Correct!') else:

print('Sorry, Try Again.')



Else always follows an If statement, but aren't always required.

Else If

Just to confuse you, the next common coding statement is the 'Else If'. This is very similar to the else statement above; however, it includes conditions (Like the if statement).

Continuing with our math app example: You are writing a maths app. You ask a question, the user types an answer, and you display the result.

In the code below, once again, we use 'user_answer' as the input given to us by the user. We use an if statement to check the answer. If the answer is correct, we print 'You Are Correct!'. If their answer is more than (greater than) 20, we display 'Way Off! Try Again.', and if they are neither correct or more than 20, we display 'Sorry, Try Again.'.

user_answer = input("What is 2 + 2?") if user_answer == 4:

print('You Are Correct!') else if user_answer > 20:

print('Way Off! Try Again.') else:

print('Sorry, Try Again.')



While Loop

Ok, so we are ready to step up the code a little :) Let's implement a 'While' statement.

A while statement is exactly what it means; It does a particular piece of code over and over (while) until certain conditions are met.

Before we look at any code, let's think of a real-world example: While there are dirty dishes, continue to wash up.

In the above example, you start to wash up dishes one at a time. After each dish is washed, you check to see if there are more. If there are more, you continue to wash them up. Pretty simple, and this is exactly how a 'While' statement works.

In the code below, we are going to make a computer code version of washing up dishes. Firstly we declare there are 25 dishes and save that amount in a variable called 'dishes'. Then we introduce a while loop that will continue to run if the 'dishes' count is more than (greater than) 0. In the loop, we display 'I washed a dish.' and then we minus 1 from the 'dishes' count. The while loop then checks the 'dishes' count, and if it is still above 0, it runs the code again. The loop finishes when the 'dishes' count reaches 0, and then the code continues down the page where it meets the next line of code. The next line after the loop is to display 'I finished washing dishes.'.

dishes = 25

while dishes > 0:

print('I washed a dish.')

dishes = dishes - 1 print('I finished washing dishes.')

For Loop

The 'For' loop works the same as the while loop; except instead of meeting a condition, a for loop runs x amount of times. Example, you may want to run code 10 times, so you would use a 'For' loop.

A real-world example: There are 5 people at the dinner table, and they all want a glass of water. You would want to loop pouring a glass of water 5 times. During each loop, you would get another glass and pour the water.

Let's turn the above example into code. In this particular type of programming language (Python), there is a function called 'range' which specifies a range of numbers. Makes things a little easier for us. The for loop starts at the first number in the brackets, counts up, and finishes at the last. With each loop, it displays 'I got a glass.' and 'I poured the water.'. Once the loop has finished, it displays 'I poured all 5.'.

for i in range(1, 5):

print('I got a glass.')

print('I poured the water.') print('I poured all 5.')

Combining Coding Functions

Now you have some very basic coding statements and functions. Let's see if we can create a piece of code that combines all of our techniques learnt above.

In this example, we are going to display messages to the screen that indicate a step taken. We are hosting a lunch for 6 people, and cleaning up after. See if you can work out what is going to happen below in the code.

guests = 5

me = 1

total_people = guests + me

waters_needed = 0 + me

existing_dishes = 10

new_dishes = 0 for i in range(1, guests):

print('Welcome')

guest_answer = input("Would You Like a Water?")

if guest_answer == 'Yes':

waters_needed = waters_needed + 1 for i in range(1, waters_needed):

print('I got a glass.')

print('I poured the water.')

new_dishes = new_dishes + 1 for i in range(1, guests):

print('Goodbye, Thanks for Coming')

dishes = existing_dishes + new_dishes

while dishes > 0:

print('I washed a dish.')

dishes = dishes - 1 print('I finished washing dishes.')

Teaching Coding Without Computers

As we mentioned in the beginning, you don't need a computer to teach code. Just use the examples and code instructions that we ran through to create real-world games and coding challenges for kids.

We will be writing a list of fun coding games that don't need a computer soon, in the meantime here are a few examples of ways to teach basic code to kids.

Help Me Get a Glass of Water

This coding game is easy and fun. Stand near the kitchen, and see if your kids can give you a predetermined set of instructions that ends up with you getting a glass of water. You can be as in-depth as you like, or a simple as you want.

Get kids to write down the instructions, or say the instructions, and then you act them out. Remember, you are a computer that does not have any grey areas, just do what they say. EG:

Turn and face the fridge.

Take 10 steps.

Pull the fridge door open.

Bend down and retrieve water jug.

Close fridge door.

Turn 90 degrees.

Open cupboard door.

Retrieve glass from the cupboard.

Close cupboard door.

While glass is not full:

Pour in water

Turn 90 degrees.

Open fridge door.

Place water jug back in the fridge.

Close the fridge door.

Turn 90 degrees.

Pick up the glass of water.

While glass contains water:

Drink water.

Take 5 steps.

Turn 90 degrees.

Place the empty glass in the sink.

The example above is quite long and complex, but you get the idea. It can be fun, and you don't need a computer. Just make sure that if it falters along the way, your kids make the necessary changes, you return to your starting position and 'run' the program again.

Help Me Get Around

Similar to the Glass of Water, you can ask your kids to help you get around the house. Let's say you want to go from the lounge to the kitchen. You need to start off facing a certain direction and in a particular spot. You can measure it in steps, or if you have a tiled house, you can use the tiles as a measurement.

Go forward 5 tiles.

Turn to the right 90 degrees.

Go forward 3 tiles.

Turn to the left 90 degrees.

Go forward 15 tiles.

The end result is for you to be in a specific spot facing a certain direction.

Treasure Map

This coding game is perfect if you have a tiled house. You can write the 'code' yourself, and get your kids to 'run' it. Just like the example above, you can start them in one area and end up at a reward or treat. Remember to start on a certain tile, and facing a certain direction.

Go forward 3 tiles.

Turn 90 degrees.

For i in range(1, 5):

Go Forward 2 tiles.

Turn 90 degrees.

Yes, we got a little tricky there. We threw in a for loop which got them to move 10 tiles in total. You can do it too!

Have Fun with Coding

My last piece of advice for anyone teaching their kids coding is to have fun. Coding is not boring, so don't make it boring. Give them results, let them make errors and fix them. Let them rejoice in success. I have been programming for over 15 years, and I love it as much today as I did when I first started.

Good luck to you all, and have fun. Please feel free to contact me if you have any questions or ideas. I love talking with the STEM community.

Coding Resources

Here are some useful resources that might help you teach code to kids:

Arduino for Kids

This is an article we recently wrote that seems to be very popular. If you have older kids, they might want to start creating real-world products and can do this using the Arduino platform.

Starting Kids with Arduino

Au Government Coding for Kids Page

The Australian Government has a webpage about kids coding as part of their 'Learning Potential' website. Here is a link.

AU Gove Kids Coding

Hour of Code Activities

Plenty of tutorials dedicated to teaching kids to code. Join the millions of kids already using the site and start creating awesome code.

Hour of Code