The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by eddylia83, 2021-02-14 08:38:25

HOW TO BE A CODER LEARN

HOW TO BE A CODER LEARN

Keywords: CODER

HOW TO BE A

Coder

Written by

Kiki Prottsman

Contents

Project editor Olivia Stanford 4 How the book works
Project art editor Emma Hobson 6 Getting ready
Additional editorial Marie Greenwood,
1 Crafty coding
Seeta Parmar, Jolyon Goddard
Design assistant Xiao Lin 10 Origami algorithm
Additional design Charlotte Jennings, Jaileen Kaur 14 Ada Lovelace
US Senior editor Shannon Beatty 16 Paper pixels
US Editor Margaret Parrish 18 Scavenger hunt program
Illustrations Mark Ruffle, Katie Knutton 20 Debugging drawings
DTP designer Mrinmoy Mazumdar 22 Loopy orchestra
Senior picture researcher Sumedha Chopra 24 Creative outlines
Jacket co-ordinator Issy Walsh 26 Games
Senior jacket designer Elle Ward 28 Illustration collaboration
Managing editor Laura Gilbert 30 Persistence pointing
Managing art editor Diane Peyton Jones 32 Conditional questions
Pre-production producer Dragana Puvacic 34 The if/else dance
Senior producer Ena Matagic 36 Alan Turing
Creative director Helen Senior 38 Balloon events
Publishing director Sarah Larter 40 Input/output recipe
44 Hardware
Consultant Sway Grantham 46 Catch me collisions
48 Variable paper chain
First American Edition, 2019 50 Fortune-teller function
Published in the United States by DK Publishing 54 Katherine Johnson
1450 Broadway, Suite 801, New York, NY 10018 56 Parameter path
58 Decompose a castle
Copyright © 2019 Dorling Kindersley Limited 62 Pattern matching creepy-crawlies
DK, a Division of Penguin Random House LLC 64 Abstraction story
66 Remixing rhymes
19 20 21 22 23 10 9 8 7 6 5 4 3 2 1 68 The internet
001–311576–July/2019

All rights reserved.
Without limiting the rights under the copyright reserved above, no part of

this publication may be reproduced, stored in or introduced into a
retrieval system, or transmitted, in any form, or by any means

(electronic, mechanical, photocopying, recording, or otherwise), without
the prior written permission of the copyright owner.

Published in Great Britain by Dorling Kindersley Limited

A catalog record for this book
is available from the Library of Congress.

ISBN 978-1-4654-7881-8

DK books are available at special discounts when purchased
in bulk for sales promotions, premiums, fund-raising, or educational use.

For details, contact: DK Publishing Special Markets,
1450 Broadway, Suite 801, New York, NY 10018
[email protected]

Printed and bound in China

A WORLD OF IDEAS:
SEE ALL THERE IS TO KNOW

www.dk.com

2 Computer coding Repeat 3 times
Strum
72 Getting Scratch Rest
74 Using Scratch Strum
76 Coding in Scratch Rest
78 Sprites
80 Algorithms
84 Programming languages
86 Coding programs
88 Debugging
90 Loops
92 Creativity
94 Collaboration
96 Persistence
98 Conditionals
100 If/else
102 Events
104 Input/output
106 Collisions
108 Variables
110 Satoru Iwata
112 Functions
114 Functions with parameters
116 Decomposition
120 Pattern matching
122 Abstraction
124 Bill Gates
126 Remixing
130 Minicomputers
132 micro:bit

135 Answers
136 Did you know?
138 Glossary
140 Index
144 Acknowledgments

How the Awesome
book works activities

In How to be a Coder, you will learn how to Look in the beginning
think and act like a coder. The book is full of of the book to find exciting
fun activities that can be done at home, as offline activities that let
well as simple programs, and information on you discover the ideas that
some of the most famous coders of all time. are important to coding.
These examples don’t
require a computer, but
they will help you prepare
to write programs.

You will need White paper Coloring pencils Eraser Turn to page 92 to learn how to 5 Think about something
or felt-tip pens code this skill that you saw or used
yesterday. Try to figure
Everything you 1 Trace or copy this 2 Pick up a template. What comes out what to add to make Each activity
need for an template onto a few to mind when you see the shape? the next template into that is broken down
blank pieces of paper. Use a pen or pencil to add details thing. How many different into steps.
activity is listed until the shape feels more like designs can you make
at the start. the thing you imagined. with just this template?

3

Pick up another template and
turn it on its side. Now what
does it look like? Draw some
extra details until you see the
image more clearly.

Creative 4 Now try... “Now try...”
suggestions
outlines Pick up your third template. Think of an everyday at the end of
What does it definitely not object, such as a clothespin, projects let you
Creativity is about coming up with lots of look like? Can you add build on your
ideas. It is helpful to think creatively when anything to it to make it and write down as many 25 new knowledge.
you are trying to solve a problem. Some begin to look more like different uses for it as possible
people think that they aren’t creative, but that thing?
those people just need practice! This activity in a minute. They don’t have
will teach you some tricks to help you to be what it was designed
unleash your creativity.
to do—be creative!
24

! Safety first Be particularly careful when:
• you are using sharp objects,
All of the projects in this such as scissors;
book should be done with
care. If you see this symbol • you are running around
at the top of a page, it with friends;
means that you will need
an adult to help you with • you are handling hot food;
the activity. • you are outside—always tell
an adult what you are doing.

4

Fpuancrtaiomns ewtiteh rs The program when clicked Cool coding

Now we are going to use our function erase all Building your own code
with parameter block to make a pattern is exciting, but it can be
of different squares with variable go to x: -30 y: 90 tricky. This book will
sizes. Each time we want to make a give you activities and
new square, all we have to do is use point in direction 90 examples for each coding
our function and add the size of idea so that you can
What happens when you want to do something over and the square that we want to draw. repeat 10 learn how to use your
over, but not in exactly the same way every time? Then new skills to make code
you need a function that you can change—a function with draw a square 20 This function with of your own!
parameters. Parameters are a kind of variable that make parameter block
your function work differently in different situations. move 60 steps draws a square with
sides 20 pixels long.
draw a square 55
This function with
turn 36 degrees parameter block
draws a square with
Make a function The sprite turns 36 degrees go to x: 0 y: 0 sides 55 pixels long.
with parameter block for every repeat. Since there
are 360 degrees in a circle, the repeat 9 This moves the sprite
We are going to make a block called “draw a square.” loop needs to repeat 10 times. to a new position to
Select Make a Block and name your function, then start drawing a second
select “Add an input” and name the input “size.” This code draws three different-sized circle of squares.
This input will be our parameter and it will change squares. Instead of making three
the size of the square. Add the code below to the “define” different functions, though, you only draw a square 30
block so it can draw a square. need one function with a parameter.
turn 40 degrees

define draw a square size

To add the “size” go to x: -200 y: -200
block to the “move
Code Costumes Sounds pen down steps” block, drag a
copy of it from the
Motion My Blocks repeat 4 size steps “size” part of the
Looks Make a Block move above function.
Sound
Make a Block turn 90 degrees

Events draw a square size Now try...

pen up Try changing the value
of the parameter “size”
Add an input Add an input text and see what happens
number or text boolean Add a label to the pattern. How big
a square can you make?
Run without screen refresh draw a square 50 How small a square can
you see?
Cancel OK When you use your “draw a square”
function, there is a space for you to 115
Click “Add an input” to add a fill in a value for the parameter “size.”
parameter to your function.

114

Each coding idea, and the Test each coding
blocks needed to code it, concept using the
are explained simply. provided program.

Top topics Scratch Python JavaScript Ruby

Learn about some Date created: 2003 Date created: 1991 Date created: 1995 Date created: 1995
of the key coding Creator: Massachusetts Creator: Guido van Rossum Creator: Brendan Eich Creator: Yukihiro Matsumoto
topics, such as hardware, Institute of Technology (MIT) Country: The Netherlands Country: USA Country: Japan
the internet, and Country: USA Text or blocks: Text Text or blocks: Text Text or blocks: Text
programming languages. Text or blocks: Blocks
These will help you Python is a text-based language. It’s a great tool JavaScript is everywhere! It’s very fast and used Ruby is a fairly simple language that allows
understand the craft Scratch is a visual programming language. for teaching people to code, since it stresses by lots of applications, especially web pages! a lot of freedom and flexibility. It is very
and coding projects. Code is written by dragging blocks from a good habits. However, Python could not be However, it runs on the user’s computer—not on popular and great for beginners, but
special toolbox. This is great for new coders, used for programming 3-D games or other an online server—so it can be less secure than because it doesn’t require a strict structure,
since commands are premade and easy to tasks that require a lot of computer memory. other languages, and can look different, bugs can be introduced in Ruby that are
use, but advanced users might prefer a text depending on the browser you use. well disguised and very hard to find!
language where they have more freedom.

when clicked print(“Hello, World!”) alert (“Hello, World !”) ; puts “Hello, World!”

say Hello, World! In Python, you must tell This command will get This command is just
the program to print your JavaScript to show your like “print” in Python.
Type your phrase command, then it will phrase in a pop-up box It tells Ruby to show
into the “say” block show up on-screen. in your browser. your phrase on-screen.
and Scratch will have
your character say it! “Hello, C++
World!”
Plaronggraumamginges Date created: 1969
It’s a tradition among Creator: Bjarne Stroustrup
Programming languages, or computer languages, programmers to have Country: USA
are sets of code that computers can understand. the first program say the Text or blocks: Text
Each language has its good points and bad points. phrase “Hello, World!”
Depending on what a programmer needs, they when testing the new C++ is a complex language that is very popular
might find that a certain language works better language. Some coders with professionals because of its speed and
than another for what they want to do. believe that they can tell reliability. However, it’s not always the best
how difficult a language language for new programmers, since it
84 will be based on how requires a lot of code to do even simple tasks.
easily they can get the
computer to say “Hello, #include <stdio.h>
World!” in that language. main{}{printf(“Hello, World!”;}

85

Katherine Moon landing Great coders

Johnson Johnson’s calculations were so Anyone can learn how
accurate that NASA often asked to code, and this book
Mathematician • Born in 1918 John Glenn blasted her to confirm the results coming will show you the
• From the United States off into space on from their expensive electronic people who have made
February 20, 1962, computers. Her work contributed a difference in the world
Johnson is a brilliant mathematician who in the Friendship 7 to the Apollo 11 mission in 1969, with their coding skills.
spacecraft.
which resulted in the world 5
helped to figure out the flight paths of early watching as the first astronauts

spacecraft. She worked for the American walked on the moon.

Buzz Aldrin was the
second person to walk
on the moon, after
Neil Armstrong, who
took this picture.

space agency NACA, which later

became NASA. Her drive helped Blast off!
her become one of the first
women allowed to go to secret In 1962, John Glenn became the
government meetings. first person to orbit the Earth. The
path his spacecraft followed was
calculated by electronic machines. Counting everything
However, John, uncomfortable with
the new technology, asked for Even as a child, Johnson loved
Johnson to double-check the numbers. She counted everything,
numbers by hand. from the number of plates and
spoons that she washed in the
Human computer kitchen to the number of
steps she walked down a
Back in 1952, before digital computers, the road. Mathematics came
word “computer” was used as a job title. so naturally to Johnson
Human computers were intelligent people that she skipped years
like Johnson who figured out, or “computed,” of school!
tricky math problems.
55
54

Getting
ready

You can do many of the projects in

this book right away. Most of the A keyboard is
craft projects can be done with essential for
items you have at home and the coders to write
their code with.

coding projects just need a computer Learninsgoltvoincgopdreobisleamllsa. bout
and an internet connection.

What is a coder?wpHhawliiAaoanntoyhvwsdceritonepkortdvgur.taoeSehctctrorepht,imroiriejscsouneepgasps!itrc,rapaooolnmeigdrkorreesc,aerooymwvsdnoeipeuftrwr,oyhowthrgddoofiarrlumalaywngmwat.rekioiYfntteooebgbursceeooadtarmtoleicpvnroui’tndtgeerr.s

tMthcYooiionsmsuitccpaaodlrnmoitcnaapc’totlusedtnodeienbrcegseod.lmiuakspeeudte. r

6

Get your pencil ready.
It can be helpful to draw
or write problems out
before you start to code.

Thinking like a coder

Coders have all kinds of talents. One thing that
most coders share, however, is a love of problem-
solving. If you want to think like a coder, keep
these things in mind:

1 Coders think ahead. Programs can be complicated,
so it is helpful to know what you want at the start.

2 Coders break things down. By taking one piece
of a plan at a time, you can try different things
without changing the rest of your program.

3 Coders are imaginative. Start by imagining what
your code will do before you make it. This will help
you think of different types of program to create.

4 Coders are careful. One little mistake can keep
your whole program from working, so always
check your code twice.

5 Coders solve mysteries. When something is not
right, see if you can find any clues about what
went wrong.

6 Coders are persistent. Decide to try again. Try
over and over. If you quit too soon, it will be
hard to learn anything new.

7 Coders don’t give up. If something doesn’t work
out, don’t worry. Everyone makes mistakes! You
can still end up with something you’re proud of
in the end.

7

S tory Orchestra Dance
Balloons
Recipe

Paper chain O

Crafty rigamiRhymes
coding
Outlines
The ideas that computer scientists
use in coding can be found everywhere.
In this chapter, you will see them in
arts, crafts, recipes, and games! Try
these activities to get familiar with the
concepts that coders use every day.

Questions

You will need Paper Turn to page 80 to learn how to
code this skill

2

Using paper that is colorful or 1 Begin with a Fold the paper in half
patterned on one side will help you rectangular piece again, from left to right,
to follow the steps of the algorithm. of paper—letter size and press firmly along the
works well. To start, fold. Then unfold it.

fold your paper in half,

from top to bottom.

Origami algorithm

An algorithm is a list of steps that tells you what to do.
A recipe is an algorithm and sheet music is an algorithm,
too. Algorithms are the first step in planning a computer
program. Did you know that you can follow an algorithm
to make an origami boat?

10

3 Next, fold the top-left corner toward the
center line, then fold the top-right corner
down to meet it. This will create a triangle
with a rectangle at the bottom.

It is important to The bottom rectangle will 4
follow the steps be made of two sheets of
of an algorithm in
the right order, or it paper. Fold the upper
won’t work properly. piece up, over the base of

5 triangle along the line
where they meet.

Tuck the corners that stick out
over the triangle behind it, and
flip the whole thing over.

Fold the remaining You’re already
sheet of the rectangle halfway through
up along the line where the origami
it meets the triangle. algorithm!

6

11

7 9

The next part is a bit As in step 7, put your
tricky. Put your fingers fingers inside the two
inside the pocket made halves of the triangle and
open it out, pushing the
by the two halves of ends together so it folds
the triangle and open it into a diamond.

out, pushing the ends 8
together so it folds
into a diamond. The bottom half of the diamond
will be made of two halves. Fold the
top half up to meet the top of the
diamond, then turn the whole
thing over and fold the second half
up as well. This will create a triangle.

Each step of making this
origami boat is another
step in the algorithm.

12

10 For the final step, take the top
loose points of the diamond and
pull them outward to make your

boat. The algorithm is complete.

Ahoy!

13

Ada The analytical engine was an
Lovelace early computer—it could be
programmed and had memory
Mathematician • Born 1815 to store information.
• From the United Kingdom

Ada Lovelace was the daughter of the
famous poet Lord Byron. Though her
mother discouraged her from studying
poetry, Lovelace found an outlet for
her imagination in mathematics and
technology. She believed both could
change the future.

Charles Babbage

Lovelace met inventor Charles
Babbage when she was 17, and
they became good friends. He
had designed the “analytical
engine”—a mechanical machine
that could be programmed to

solve tricky calculations.
The machine was not
built in his lifetime, but
Lovelace was still
fascinated with its
potential uses.

14

Analytical engine

Lovelace translated an article about
the analytical engine from French
into English. She added her own
thoughts to the pages, and among
those notes were plans for how
the machine could be programmed.
Some consider these notes to be the
first computer algorithm—making

Lovelace the first published
computer coder.

To tell the engine what Early life
to do, a series of cards
with holes punched into A scientist from a very early
them would be inserted age, Lovelace wrote to her
into the machine. mother at 12 that she had

visions of creating a mechanical
flying horse with wings so large

that it would be capable of
carrying a person on its back!

Inspiration

Lovelace’s ideas about the
analytical engine inspired
future programmers. Alan

Turing, who designed
early computers, wrote

about her article over
100 years later. Every

second Tuesday of
October she is celebrated

on Ada Lovelace Day.

15

You will need Colored Ruler Pencil Safety
paper scissors

Paper
pixels

Pixels are the tiny squares of 1
colored light that make up your Use a ruler to divide two
screen. If you zoom in on an different-colored square
image on a computer, you’ll pieces of paper into 8 by 8
see that it’s actually made up grids. We’ve used green and
of many single-colored blocks. yellow paper.
Try following these steps to
make a pixel image with paper!

2 3
Cut along the lines using safety Next, grab the piece of white paper.
scissors so you end up with It should be the same size as the
64 paper pixels of each color. pieces of colored paper. Again, draw an
8 by 8 grid on it—but don’t cut it up.
16

White !Glue Turn to page 77 to learn how to
paper code this skill

4 Follow the instructions to fill the grid Instructions
in and reveal a mystery picture. To
figure out which spot each paper Fill in the following squares
pixel goes in, you need to assign a with your paper pixels:
code to the columns and rows. Here,
the letters tell you which column to Yellow: B5, C6, D7, E6, F5
use and the numbers tell you which
row. Once you’ve found the right Green: A4, B3, B4, C2, C3, C4, C5,
square, glue the correct colored D3, D4, D5, D6, E2, E3, E4, E5, F3,
pixel there. F4, G5, G6, H6

8
7
6

5 BCD EF G H
4
3
2
1

A

Turn to page 135 to see the finished picture. 17

You will need A friend Two or three Paper or Pen or
items to hide notepad pencil

Spcravoegngrear mhunt Once you and your friend
have decided on your symbols,
A program is an algorithm, or set of
instructions, that has been written in get your friend to look away,
a special code that a machine can read. or step out of the room.
You can make up your own code and
write a program with it to help a 2
friend solve a scavenger hunt!

1

First, you and your friend should decide on a set of
5–10 coded symbols that stand for the actions that you
are allowed to take to find the treasure. These can be
anything that will remind you of what they mean—for
example, you might want to use an arrow to mean “Take
a step forward.” Here are some examples you can use:

R

Crouch down Look underneath Turn right

L

Move forward 3 steps Pick it up Turn left
18

Turn to page 86 to learn how to 3 Hide your objects around the
code this skill room, and remember where they
are—you will need to be able to
use your symbols to guide your
friend to their locations.

R

4

Pick a starting point and use your
symbols to write out a program

for your friend to follow. You might
have to practice to figure out

how many steps they will need
to take, or which way to turn.

5

Guide your friend to the
starting point, give them the
program, and watch them go!
Did your code work? How
many of the items were
they able to find?

19

You will need White Pen or Felt-tip pens or
paper pencil coloring pencils

Debugging
drawings

Debugging is an important part of coding.
It is easy to make errors when translating
algorithms into code. This activity will help
you find and fix the mistakes, or “bugs,”
in the instructions for drawing a shark.

1 Fold your paper in half the long way three times
in a row, then open the paper back up. Next, fold
the piece of paper in half the other way three times
in a row and then open it back up again. You now
have a grid of fold lines for the rest of the activity!

y
8
7

6

5

4

2Like connect the dots, this 3
2
activity is played by drawing
lines from one location to

another. Each fold line is given 1

a number so you know where 0 x

to draw. Start by putting your 0123456 7 8
pencil down at the corner that
represents 0 squares over and Start by drawing a line from 0,2 to 1,4. The first
number represents the lines going across and the
2 squares up. second number represents the lines up and down.

20

Turn to page 88 to learn how to
code this skill

y Follow the directions
8 in the boxes and you

37 will see a shark start

6 to appear!

Go down diagonally
5 to 3,2. Then go

4 straight down to 3,1.
Next go up diagonally
3 to 4,2, then 6,3, and

again to 7,4. Now go
2 straight up to 7,5.

1

0x

012 345678

Oh, no! Some of the 4 y
instructions in this box 8

are not right! Can you 7
find and fix the bugs in
the numbers to make the 6
picture look like a shark?
5
If you’re having trouble finding 4 x
the errors, take a look at the 3 8
shark below and see how you
can change the instructions 2
to match the shape.
1
0

0 12 3 4 5 6 7
Go diagonally up to 6,6, then across to 4,6,
and diagonally to 3,4. Go to 3,6 and then
diagonally down to 1,5. Finish at 0, 1.

Once you’ve fixed the shark 5
you can color it in. Don’t

forget to add the details of
its eye, gills, and teeth!

Turn to page 135 to check the answer. 21

You will need Rubber Plastic tub One or Bowl or
bands or cup two friends bucket

Give a friend the 2
bowl and spoons
to use as a drum.

Choose a third friend to
be the singer. If only two
friends are playing,
someone can sing while
they play an instrument.

3

1 Stretch the rubber bands
around the plastic tub. Make
! sure they are loose enough
that you can grab and pull
them to make noise, but not
so loose that they fall off.

Loopy orchestra

Repeat loops are one of the most helpful things in all of
programming! Without loops, you’d have to write each line
of code out separately, even if you wanted to do the exact
same thing 100 times. Instead, you can add a loop around
the instructions that you want repeated for as many times
as you like. You can even use loops to make music!

22

Two wooden Hairbrush ! Turn to page 90 to learn how to
spoons (optional) code this skill

Repeat 3 times 4 Each instrument will have its
Tap own set of instructions that look
Rest something like this. The loop box
Tap around them tells you how
Rest many times to repeat the
instructions inside.

5

Now, play the loops below. You
need to make sure that you all
play your parts on the same beat
for each count of four. How
did it go? Change the
instructions inside the
loops to change
the music!

The loop box tells you to
repeat the instructions inside
it three times, then stop.

Repeat 3 times Repeat 3 times Repeat 3 times
Sing “Beepop”
Sing “Beep” Tap Strum
Sing “Beep”
Sing “Beep” Tap Rest

Tap Strum

Rest Rest

23

You will need White paper Coloring pencils Eraser
or felt-tip pens

1 Trace or copy this 2 Pick up a template. What comes
template onto a few to mind when you see the shape?
blank pieces of paper. Use a pen or pencil to add details
until the shape feels more like
the thing you imagined.

Creative

outlines

Creativity is about coming up with lots of
ideas. It is helpful to think creatively when
you are trying to solve a problem. Some
people think that they aren’t creative, but
those people just need practice! This activity
will teach you some tricks to help you
unleash your creativity.

24

Turn to page 92 to learn how to 5 Think about something
code this skill that you saw or used
yesterday. Try to figure
out what to add to make
the next template into that
thing. How many different
designs can you make
with just this template?

3

Pick up another template and
turn it on its side. Now what
does it look like? Draw some
extra details until you see the
image more clearly.

4 Now try...

Pick up your third template. Think of an everyday
What does it definitely not object, such as a clothespin,
look like? Can you add
anything to it to make it and write down as many
begin to look more like different uses for it as possible
that thing?
in a minute. They don’t have
to be what it was designed

to do—be creative!

25

Games

People might decide to learn to code because
they want to make games. Computer games
are a lot of fun and very popular. Games
can be played on your own or with friends.
Increasingly, programmers have put a lot of
work into creating gaming experiences that
are easy to use and feel a lot like real life.

Virtual reality Some multiplayer
games can be
In virtual reality games, you take part in an played over the
imaginary world. A headset with a screen makes internet with an
you feel like you’re inside the game. Augmented adult’s permission.
reality games show you the world around you but

add virtual objects that you can play with.

26

Some controllers Mobile gaming
make you feel like
you’re playing a Mobile games are games you can play
musical instrument. anywhere. They used to be only played on
handheld consoles, but today’s mobile games
Special are usually played on a smartphone. Mobile
controllers games are often simple to play, which makes
them very popular among people of all ages.
To help players feel
more connected to an
activity, some games
use special controllers
that look like musical
instruments, rackets,

steering wheels, or
even magic wands.

Online gaming

You need an internet connection to play
games online. Some games can be played
by yourself, while others need two or three
players. There are some online games that
can be played with hundreds of people from
all around the world.

Games consoles

Consoles are special computers designed to run
games. Popular consoles include Sony PlayStation,
Nintendo Switch, and Microsoft Xbox. Many games
are made especially for consoles. They can be very
complex and may come with special controllers.

27

You will need White Pencil A group
paper of friends

Illustration

collaboration

Most coders work in teams.
Working with other people on
a project is called collaboration.
It helps you create things that
you might not have thought
of on your own. Try drawing
a picture with friends and see
what different ideas you
come up with!

1 2

Before you begin, First, draw a head, but
fold a piece of paper don’t let your friends see
in half lengthwise, what you’ve drawn. Make
then in half again in sure the neck crosses the
the same direction. first fold to give the next
Open it out and you artist something to connect
should have four the body to. Then fold your
equal rectangles. section back to hide it and
pass it to the next person.

28

Turn to page 94 to learn how to
code this skill

Each artist should Remember to fold Now try...
draw a little over the each section back so
bottom crease to the other artists can’t Instead of a drawing, why
give the next person see what you’ve not try a collaborative story?
a place to start. drawn until the end. Write down one sentence on a
piece of paper and then pass it
to a friend to write the next
sentence. Keep going for as

long as you can!

3 4 5

The next artist should Start from where the Finish off the drawing with
draw the top half of the second artist left off and the legs and feet. Once the last
body. Again, make sure add the hands and hips. artist has finished, unfold the
the lines for the body You can start the legs paper and see what you have
and arms cross the fold for the last artist, too. created together!
so the next artist can
see them once that
section has been
folded back.

29

You will need Nothing! Turn to page 96 to learn how to
code this skill

Persistence Switch both 3
hands to the
pointing opposite sign at
the same time.

Learning to do something difficult

means trying again and again until

you finally get it right. Working

hard to succeed at something

that you’ve failed at several

times is called persistence, After you’ve counted
to three, switch your
and you’ll need it when finger and thumb
instantly.
you’re learning

to program.

2 Count to three.

Make sure you don’t
have your thumb up
on your pointing hand.

Give the 1
“thumbs-up”
sign with your

left hand while

pointing forward

30 with your right hand.

5 Once you can repeat
the switch five times
without messing up, you
win! You might need to
practice a few times
until you can master
switching quickly.
Keep persisting!

1... 2... 3...

1... 2... 3...

4 If at any time you
have your thumb up
and finger pointing on
the same hand, you lose
and must begin again.

31

You will need A friend with a Turn to page 98 to learn how to
big imagination code this skill

Conditional Choose a statement
questions that can either be true

A conditional is a piece of code that checks if or false to ask your
a statement is true or false. When you see a friend, to help you
conditional, it’s like your program is asking a
yes-or-no question. If the answer is yes, then figure out which
the statement is true. You can use conditionals person or thing they
to figure out what mystery person or object have chosen for you.
your friend has chosen for you.
3

I’m
alive?

1 Together with your friend,
choose a category such
as plants, animals, or
famous people.

Have your friend 2 Hmmm...
choose someone or OK, I’ve
something from that got it.
category that you will
be—but they shouldn’t

tell you what it is!

32

4 Your friend will either Only move on to your next statement
answer with “True” once you have found out if your current
or “False.” statement is true or false.

False! True!

Repeat steps 3 5
and 4 up to 20 times.
If you guess what your

friend was thinking
before the 20th

question, you win!

“We choose the category water.”
“OK, I’ve got it!”

“I’m alive?”
“False.”

“I can float?”
“True.”

“I’m a boat?”
“True! You win!”

I won!

You will need The The day The Turn to page 100
time of the week weather

The if/else If it’s Monday to Friday, you do one of the dances on
the right-hand side of the chart. Else, if it’s Saturday
or Sunday, do one of the dances on the left.

dance x1

An if/else statement is a type of If the time is a.m. x1
conditional that runs one set x4
of code if something is true and
another set of code if it is false.
The moves of the if/else dance
change depending on if certain
statements about the time, date,
or weather are true or false.

If the time is What day of the Is it sunny x4
“a.m.,” use the week is it? If it’s outside? If it is, x1
top half of the a weekday, use do the dance x1
chart. Else, use the right half backward! Else,
the bottom half. of the page. Else, do it forward
use the left. (top to bottom).

1

To do this dance right, you have a lot
of statements to check! You’ll need to
know the time, what day of the week
it is, and what the weather is like to
figure out what dance you should do.

34

to learn how to 2 Let’s say it’s 8:00 a.m. on Monday. Since
code this skill it is the morning, you use the top half of
the chart, and because it’s a weekday,
If today is a weekday you use the right-hand box.
x1

x2

x2
x1

x2
x4

x2

x2

3

Now check the weather. If it is raining,

x 1 do the moves forward (top to bottom),

else if it is sunny, do them backward.
Here’s the dance that you’d do on a
rainy Monday morning!

35

Alan Turing

Mathematician • Born 1912
• From the United Kingdom

Alan Turing is known as the
father of computer science.
Having always been fond
of numbers, he was very
interested in problem-solving.
Turing helped to win World
War II by working to read
coded enemy messages.

Turing machines

Turing studied math at the University of Cambridge. After
graduating, he invented the concept of “Turing machines.”
A Turing machine uses a program to solve mathematical
problems using a strip of paper. Although he never built
one, this simple machine is believed to be able to solve
any problem that a modern-day computer could!

36

Checkmate

Turing helped create Turochamp, the
first program that could play chess

against a human. Unfortunately, there
wasn’t a computer that could yet run the

program, so he had to settle for being
the computer himself and running

the program with a pencil and paper!

The Enigma machine Cracking the code
changed all the letters of
a message into different During World War II, Turing helped
letters, and back again, make a device, called the Bombe, that
so only someone with an decoded the secret messages created
Enigma machine could by the German’s Enigma machine. Being
read them. able to read enemy messages helped the
Allies to win the war.

The Bombe decoded German
messages by testing every
possible combination of letters.

Artificial
intelligence

In order to test how
intelligent a machine
is, Turing suggested
a written quiz. A
person would ask
a computer that
they couldn’t see
questions and try
to tell if it was a
computer or a
human. This quiz
is known as a
“Turing test.”

37

You will need One or more A friend Turn to page 102
balloons
Whoever has the
balloons should play The person doing the Beavlleoonnts
around with them to actions needs to
see what events get a decide in their head Events are actions that interrupt
reaction from the other what they will do when a program and make something
person. Here are some certain events happen happen. If you want to have the
examples of balloon to the balloons. Choose score in your video game change
events to try: one action for each when the main character gets
different balloon event. hit by a meteor, then you will
Shake the balloon Here are some example need an event! Here, the game
actions: is to play with balloons and
Drop the balloon try to guess what event your
Run on the spot friend is reacting to.
Hug the balloon
Clap
Poke the balloon
Wave

1 First, decide who will play with the balloons
and who will do the actions. The goal is for
Jump the person playing with the balloons to

figure out which balloon events cause the
other player to do certain actions.

To play, start trying different 2
events with the balloons. If the
other player sees an event that
matches their idea for an action,
they should do it. For example,
hugging a balloon might make the

other player clap their hands.

38

to learn how to
code this skill

3 Once you have figured
out the action for each
different balloon event,
move on to the next one.

Once you think you’ve
figured out an event
that gets a reaction,
repeat it to see if the
other player does the
same thing again.

Keep trying different events 4
with the balloons to see

what gets a reaction. What
happens if you throw a
balloon in the air?

5

Once the person with the
balloons has figured out what all
the event-action combinations
are, it’s time to switch roles!

39

You will need Apron Two mixing Table Pitcher
bowls knife

Ingredients 1¾ cups Pinch 3½ tbsp ½ cup grated
flour of salt butter cheese

Input/output recipe

Input is the information you give to a computer, such as the
text you type on a keyboard, and output is the information the
computer gives you, such as what appears on the screen. In this
recipe you can use different ingredients (the inputs) to make
two different types of biscuit (the outputs)!

Ask an adult to preheat the oven to Work the butter into the flour with your
425°F/220°C. Then put the flour, salt, fingers until the whole mixture looks
and butter into a mixing bowl. like a bowl of bread crumbs. Now put
Carefully use a table knife to cut the half of the mixture into a new bowl and
butter into small cubes. get ready to add the different inputs.

1! 2

40

Rolling pin Cutter Baking Pastry Turn to
sheet brush page 104

2 tbsp sugar and ½ cup milk and ! to learn how to
1⁄3 cup golden raisins a little extra code this skill

The different inputs will If the mixture is too
give you two different wet you can add a
types of biscuit that taste little more flour.
and look very different!

Add the grated cheese to Add half the milk to the cheese
the mixture in one bowl—this
4 mixture...
3 is for your cheese biscuits.

In the other bowl, add the ... and the other half to the fruit
sugar and golden raisins to mixture. Stir each to combine all
make your fruit biscuits. the ingredients.

41

Knead both mixtures with your hands until Use a 2 in (6 cm) pastry cutter to cut
they are smooth balls of dough. Use a rolling out your biscuits. There should be
pin—or your hands—to flatten both doughs enough dough for at least six biscuits
until they are about 1 in (2 cm) thick. of each flavor.

56

42

7 Space the biscuits out on a
baking sheet, then brush the
tops with milk using a pastry

! brush. Ask an adult to put them
in the oven and bake them for 12
to 15 minutes, until they are
golden brown.

8

Once they have cooled, you
can enjoy your biscuits! Do
you see how the different
outputs were affected by the
different inputs you put in?

43

Hardware Computer

Hardware is any part of a computer that A computer is a
you can touch. Most pieces of hardware, machine built from
such as a keyboard, come with little bits various pieces of
of code, called drivers, that help the hardware, some of
computer know what to do with them. which you can see, and
Different types of hardware can be used some which are found
to input or output information or to help inside it. PCs are
the computer run. computers, but so are
many other devices,
such as smartphones.

A keyboard is used to input
words and numbers, as well
as to control the computer.

Central Graphics card RAM
processing unit
A graphics card handles the difficult RAM stands for
The central processing unit (CPU) is calculations that go with displaying “random access
like the brain of the computer. This pictures and images on the screen. memory.” It acts as
is where all of the most important Some cards have their own graphics lightning-fast storage
decisions are made. The CPU sends processing unit (GPU) to reduce the that your computer
and receives information, makes amount of work the CPU has to do. can use to save
calculations, and carries information when
out instructions. Graphics cards the CPU gets full.
connect directly to
the motherboard. Information is
stored on tiny
devices called
memory chips.

Today’s CPUs
have several
“cores.” This lets one
CPU process multiple
instructions at a time.

44

A monitor, or How a computer works
screen, lets you
see what’s A computer takes input from a user or sensor,
happening. processes it—often using a central processing
unit—and then is able to store the result in its
memory or output it.

A speaker Memory
changes audio
signals into sound.

Central processing unit

Input Output

The mouse lets Motherboard
you interact with
the computer. The motherboard is the piece of
hardware that connects all of the other
Hard drive parts together. It’s the main connection
point for a computer’s cards, chips,
The hard drive is the part of the and cables.
computer where information is stored.
Some hard drives have a spinning disk Some motherboards
inside, while others are more like a include a fan to
giant store of RAM. keep the CPU cool.

This hard drive
saves data on a disk.

The RAM connects These slots allow you
straight to the to connect other devices.
motherboard, too.

45

You will need Three or Turn to page 106 to learn how to
more friends code this skill

Catch me When the catcher catches, or
collisions “collides” with, a player, that player
should freeze with their arms out.

2

In coding, collisions happen when two or Make sure you collide
more things touch. They let characters gently with your
pick up objects in video games and they friends! You don’t
stop your cursor when it hits the edge want to hurt them.
of your screen. In this activity, you have
to avoid colliding with the catcher or GO!
you’ll be stuck!

1

Decide what part of the room or yard is your
playing zone. Choose someone to be the “catcher”
and have them stand in the center. Everyone else
should stand at the edges. When the catcher shouts
“GO!” everyone should start running around.

46

Another player can free a frozen 3
player by touching them on the
shoulder. Then the frozen player

can start running again.

The game is over
when all players
except the catcher
are frozen in place.

4

47

You will need Colored Ruler Safety Die Sticky
paper scissors
!tape

Variable Variables allow parts of a
program to change, even while

it is running. All you have to do is

paper chain choose a word to hold the place
of the part that will change—this

word is your variable.

Cut paper to length: Variable
dieRoll + 5 in (12 cm) algorithm

Tape paper into circle This algorithm shows you how
to make a paper chain with
Repeat 15 times different-sized links. It
contains a variable called
Cut new strip: dieRoll + “dieRoll.” Whenever you see
5 in (12 cm) it, you roll a die and use the
number that you rolled in
Hook paper strip through place of the variable. This
the end of the last link and means the algorithm can
tape closed change depending on the
value you roll.

Start by cutting a piece 1
of paper into strips
along its full length,

each about 1 in (3 cm)
wide. You can use
a few different
colors of paper.

48


Click to View FlipBook Version