0% found this document useful (0 votes)
890 views82 pages

Early Coding For Kids e

Early coding for kids ebook.

Uploaded by

Simbiat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
890 views82 pages

Early Coding For Kids e

Early coding for kids ebook.

Uploaded by

Simbiat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

SAMPLE COPY

Contains sample lessons from


levels 1 to 5

Computer Programming, Digital Citizenship and


Analytical Thinking for Children

Algorithms Conditionals Loops

Games Scratch Python

Lead Author
David Ogunshola
Levels 1 - 5

A series of five curriculum-based textbooks


that teach computer programming to children
and young learners, usable in primary and
secondary schools

www.earlycodingbook.com
About the Author

David Ogunshola is widely recognized for his work as an innovation catalyst. He has a
Bachelor's Degree in Computer Science, M.A. in Organizational Leadership and an M.Ed in
STEM Education from the American College of Education. He holds the National Certificate for
STEM Teaching (NCST) a prestigious certification offered by the National Institute for STEM
Education (NISE) in the USA.

David has worked for more than 15 years as a Software Developer, Tech Founder and
Educator. He is the co-founder of Brainy Hive Schools, a future-driven K-12 school in Nigeria,
founder of EarlyFounders Labs - a tech and startup school for children and Founder of
Daveshoope Inc, a Software Development & AI Consulting company.

His interest in high-quality disruptive education and desire to lower the age of innovation in
Africa led him into education and pedagogy. He has had successful results teaching children to
code and launch startups as teenagers. The lack of age-appropriate educational resources for
his teaching needs inspired the journey into the creation of these and many more books and
learning pathways. The books have undergone multiple iterations and every lesson in each book
has been tested in a real classroom.

You can reach David on:


[email protected]
+234 7061386323
www.davidogunshola.com
Note to parents & teachers
Coding is another word for Computer Programming. It is simply telling a computer what to
do in a language that the computer understands. Coding is a new area of literacy that
children will need to learn and master in the 21st century and going forward, irrespective of
the career fields they choose to pursue.

These books are aimed at teaching children and young learners not just to be consumers
of technology but to be creators and inventors. Early Coding (Levels 1 to 5) will help
children to understand how the computer thinks and how to create their own programs,
games, animations and anything they can imagine using a computer programming
language. It has been designed in a way that it can be used in schools or at home for
personal learning. There is no age limit on who can use the book, even children from age
five can understand the concepts.

Many people assume that coding is too difficult for children to learn, but we have seen
children from age five learn how to code.

Your child/student would not only be learning to code. Beyond programming computers,
here are other skills that children learn in the process that they can transfer to other areas
of their lives:
How to recognize patterns and follow a sequence of actions to accomplish tasks
Analytical thinking and problem-solving - the ability to look at big problems, study them
and break them down into smaller parts to find solutions
Concentration, discipline and perseverance to finish tasks they start
Creativity and imagination: the ability to ask questions, experiment, make mistakes and
learn from their exploration
Digital Citizenship: the responsible use of technology, especially in a world that is
becoming increasingly internet-driven
And much more

Our goal is not just to teach coding but to prepare children to be creative thinkers and
problem solvers.

Not all the lessons and activities require a screen, but many of the applications and
experiments will be made using a programming language called Scratch in the earlier
levels and Python in advanced levels. Scratch uses commands in the form of blocks
dragged together to instruct the computer. Scratch and Python are free and work without
the internet. Children would require access to a computer to make the best use of these
books.

David Ogunshola
[email protected]
Sample lessons from Level One - Five
Computer Programming, Digital Citizenship and
Analytical Thinking for Children

David Ogunshola
table of contents

The amazing world of Computer Programs


computers

Programming Coding
Languages

Algorithms Sequence Bugs

Pathway Ninjas Debugging

Binary Coding Coding with Scratch

Staying Safe Online The Internet

David Ogunshola
www.earlycodingbook.com
Computer programs
How computers know what to do

Computers do not think and cannot figure things out themselves the way human beings
can, they only follow instruction that has been given to them by human beings.

A program is a list of instructions that The instructions in a program need to be


tell a computer what to do. written in a step-by-step way so that the
computer can follow the steps.

Computers have a brain called 'memory' where all programs are stored. When a computer follows the
instructions in a program given to it, we say the computer is running the program.

Computers can only run programs that have been stored in their memory. The process of adding a
program to the memory of a computer is called installation.

How programs work

Event End
Something or someone Program
tells the program when The computer begins to When the instructions
to start. This could be a follow the list of are over, the computer
button, a voice instructions provided in does something to let
command or instruction the program. you know it has
from another program. completed.

Example of how a program works


A teacher says:
1. Adam, come to the front of the class”
2. “Clap 10 times and then jump”
3. When you’re done, go back to your seat

The EVENT is the teacher calling Adam out

The PROGRAM asks Adam to clap 10 times and jump

When the program ENDS, Adam returns to his seat

8 David Ogunshola
www.earlycodingbook.com
Your first computer program
The robot needs to get to the cookie. We would write a program to help the robot reach the box
with the cookie.

Program
1. Move Right
2. Move Right
3. Move Right

Each time you instruct the robot


to "Move Right", it takes one
step to the right direction

Using the following instructions, help the robot get to each cookie:
MOVE RIGHT MOVE LEFT MOVE UP MOVE DOWN

Program
1.
2.
3.
4.
5.

Program
1.
2.
3.
4.

Computer Games, Mobile phone apps, Traffic Light Controllers, ATM Machines, and Elevators are all
examples of computer programs.

What other programs can you think of?

9 David Ogunshola
www.earlycodingbook.com
algorithms
How computer programs know what to do

An algorithm is just like a recipe. If you want to bake a


cake, there are steps you need to follow.
An Algorithm is a list of all the
steps that need to be performed Even if you have never baked before, if you follow those
steps, you will be able to make a cake. Algorithms help
in order to complete a task. computers know exactly what to do.
Every computer program is an algorithm that has been
programmed using code for computers to understand.

Algorithms in everyday life


Even though you don't realize it, almost everything we do everyday follows an algorithm. You follow
an algorithm every morning when you prepare for school.

ALGORITHM FOR GETTING


READY FOR SCHOOL
1. Wake up
2. Take your bath
3. Get dressed
4. Eat your breakfast
5. Pack your bags
6. Go to school

If you program this algorithm into a


robot, the robot will also be able to go
to school everyday.

How to create an algorithm


You need to start by thinking about all the steps
involved in the task you wish to perform, then
arrange the steps in the right sequence, starting ALGORITHM FOR MAKING
from the first to the last. A CUP OF TEA
Each step needs to be clear so that anybody
reading the algorithm knows exactly what to do. 1. Boil water
2. Pour water in a cup
Once you are done listing the steps, you have 3. Put a bag of tea
created an algorithm for that task.
4. Add sugar
Every computer program, from your mobile phone 5. Stir together
music player, the ATM machine and even websites
you visit follow an algorithm.

13 David Ogunshola
www.earlycodingbook.com
sequence
Making things follow the right order

All instructions given to a computer contain a list of steps, but these steps need to
be performed in a particular order for the task to be correctly done.

A sequence is the order the steps Even when the instructions are correct, there would
be a bug if the sequence is wrong. For computers to
needed to complete a task must complete tasks, we need to write our codes or
follow. algorithms in the right sequence.

Example: list all the numbers from 1 to 5 in the right sequence


Even though all the numbers from 1 to 5 are listed in both boxes, only one of them follows the correct order.

1 3 4 2 5 1 2 3 4 5

Make a cup of tea


Look at the steps that need to be performed to make a cup
of tea. Can you arrange these steps in the right sequence?

List of steps (not arranged) What is the right sequence?


Add sugar

Stir the contents

Add teabag

Pour the water in a cup

Add Milk

Boil water

17 David Ogunshola
www.earlycodingbook.com
pathway ninjas
Following Algorithms You will need crayons

To become a good programmer, you need to understand how computers follow instructions,
In Pathway Ninjas, you pretend to be a robot. You have been given an algorithm to follow.
Each algorithm has instructions and a pathway map to follow. Follow each step in the algorithm and do exactly what it says
on the map.

Pathway 1
Follow each step on the map
1. Go right one step
2. Go up two steps and colour the box orange
3. Go up two steps
4. Go right one step and colour the box blue
5. Go right two steps and colour the box green
6. Go down four steps and colour the box
purple
7. Go left 2 steps and colour the box yellow

Map
(Start where the arrow is)

If you do not have crayons, just use your pen to color the box.
You should have something like this.

Pathway 2
Follow each step on the map

1. Go right five steps and colour the box


2. Go left one step
3. Go up two steps and colour the box
4. Go left two steps and colour the box
5. Go up two steps
6. Go right three steps and colour the box
7. Go down three steps and colour the box

Map
(Start where the arrow is)

22 David Ogunshola
www.earlycodingbook.com
Pathway Ninjas without words
Now let us convert our words to codes. These would be our codes

Go up Go Right Go Left Go Down Colour Colour


Red
Can you solve the following algorithms?

Pathway 6
1.

2. Go Right
3.

4.

5.

Map
(Start where the arrow is)

Pathway 7
1.

2. Go Right
3.

4.

5.

Map
(Start where the arrow is)

24 David Ogunshola
www.earlycodingbook.com
Binary Coding
Computers and all electronic devices do not read words the way human beings do. They only recognize a
special language where there are only two alphabets, this language is called binary language. When
programmers write code in any programming language, the code is eventually converted to binary so
that the computer can understand.

The Binary language is a system of writing


that uses only two numbers: 1 and 0.

To learn binary, we would convert all the letters in the English alphabet to binary. Each alphabet has
eight binary characters consisting of 1’s and 0’s.
Each character is called a Bit.

The Binary Alphabet Chart


A 01000001 N 01001110

B 01000010 O 01001111

C 01000011 P 01010000

D 01000100 Q 01010001

E 01000101 R 01010010

F 01000110 S 01010011

G 01000111 T 01010100

H 01001000 U 01010101

I 01001001 V 01010110

J 01001010 W 01010111

K 01001011 X 01011000

L 01001100 Y 01011001

M 01001101 Z 01011010
26 David Ogunshola
www.earlycodingbook.com
binary decryption
We can use binary chart to convert binary code back to normal text.
This is called Decryption.
Decryption is the process of converting information from code back to what people can read.
To do this, we would use the binary chart again to see what alphabet the code represents.

01000010 B 01000111
01010101 U 01010010
01000111 G 01000101
01000101
01001100
01001110
01000001 Hint: this is a color

01000111 01001101
01001111 01001001
01010011 01001100
Hint: this is a city in Africa
01001011

activity
Choose a word. Encrypt it into binary and exchange your book with a friend to see if they can
decrypt your word. Do not tell them what word you encrypted allow them to figure it out.

28 David Ogunshola
www.earlycodingbook.com
Manage sounds Full screen
Change costume Start your program Stop your program

www.earlycodingbook.com
Sprite

This is what Scratch looks like on a computer

David Ogunshola
Coding area
Drag your blocks of

35
code out here.
Stage
Show sprite
Hide sprite
Choose backdrop
Change size of
sprite
Code block
Rename sprite
categories Choose sprite
How to get Scratch
You can use Scratch on a computer or on some mobile devices. It can work on Windows, Apple
and Chrome laptops, or on special Android devices. This allows you to work in Scratch without
having an internet connection.
You can also use Scratch on the internet using any browser without installing the application on
your device.

Installing Scratch on your Computer Using Scratch Online


1. Visit the scratch download page scratch.mit.edu/download 1. Visit the scratch website
scratch.mit.edu
2. Choose the operating system of your computer. Scratch 3.0 works 2. Sign-up to create an account by
on devices with the following: clicking on “Join Scratch”. You will
Windows 10+ need to have an email address or gain
MacOS 10.13+ permission from an adult to use their
ChromeOS email address.
Android 6.0+ 3. Follow the instructions: select a
Older versions of Scratch may work on older computers, but we recommend
username and choose a password and
Scratch 3.0 for use with this book.
create your account
3. Download the version for your laptop and follow the instructions to 4. When your account creation is
install it successful, click on “Create” to open
the Scratch editor and start coding

Starting Scratch
Once you have installed Scratch on your device, you can
start it by clicking on the Scratch icon.

Before you begin using Scratch, there are four important things you need to know:

The Stage Sprite


This is where everything happens. Whatever
you program will be seen on the stage. You Each object in Scratch is called a Sprite.
can ‘Start’ and ‘Stop’ what is happening on You can add sprites by choosing from the
the stage the green flag library, painting your own, uploading an
or red stop symbol at the top of the stage. image or taking a picture with your
computer camera.

Blocks Backdrops
Blocks are command used to tell a These are images that determine the
sprite what to do. When you combine scene on the stage. You can add
multiple blocks together, it is called backdrops to your stage to make it look
a script. different.

36 David Ogunshola
www.earlycodingbook.com
ScratCh blocks
All the commands in Scratch are arranged into categories. In each section, you will find blocks
that do similar things. The major block categories in Scratch are explained below:

The motion category contains blocks that control the


movements of a sprite.

Blocks that control the appearance of a sprite,


backdrops and what the sprite says during animations

Contains blocks that play sounds

Blocks that determine when a sprite starts doing


something or when it stops doing something

Blocks that help the sprite make decisions or what to do

Blocks that help the sprite know when it interacts with


its environment or other sprites

Blocks that helps the sprite perform some calculations

Blocks that control information that changes while you


run your program

Here a programmer can create their own blocks to do


things that they want them to do

37 David Ogunshola
www.earlycodingbook.com
Scratch Project

Follow the mouse


Create a program where a sprite follows the mouse whenever you move the computer
mouse around.

What to do
Open a new Scratch project and
delete the cat sprite

Add a new sprite to the stage. I


have chosen the Beetle sprite

Blocks you will need

This block makes the program start when the flag


is clicked.

Everything inside the block will continue to run


until you stop the program

Makes the sprite turn to face the mouse

Makes the move a certain number of steps

Challenge:
Can you make the sprite move faster
towards the mouse?
What would you change to make that
happen?
What other block can you add into the
code to add more fun to the project

David Ogunshola
41 www.earlycodingbook.com
Challenge yourself
With the little you now know about Scratch, here are ideas of things you could try to
create until you get a copy of Level Two of this book.

Make a talking sprite


Create a sprite giving a short speech. Make a list of the things
you want the sprite to say and arrange them in a sequence using
the say block. You can use as many say blocks as you need, and
you can change the number of seconds that each line displays.

You can also make it more fun by making the sprite change they way it
looks when it says different things

Make a flying sprite


Create a sprite and make it fly to different parts of the stage multiple times or without
ending.
.
Your sprite could be a bird.
One block you would need is the glide block.
Use your imagination to find out the other blocks you could use.

44 David Ogunshola
www.earlycodingbook.com
Computer Programming, Digital Citizenship and
Analytical Thinking for Children

David Ogunshola
table of contents

Computational Thinking Events


How computer programmers How to get things to started
solve problems

Patterns
Noticing when things repeat
themselves

Loops Sprites Motion


Making things happen again The objects we Making things
and again program move

Directions Coordinates
Which way should Understanding how
things go things move

Sounds Projects
Giving sound Push your imagination and
effects to programs develop your skills

Your Digital Footprints Internet Privacy


Why you should watch your More tips on staying safe
steps online online
computational thinking
Breaking down big problems so you can solve them

Computer programming is about solving problems. Almost every computer program was created in an
attempt to solve a problem, and to be a good programmer, you must understand the process of solving
problems.

Computational Thinking is the process of breaking down a problem or task into simple steps
that a computer is able to understand.

Some common problems solved with computer programs


Problem The Programmers' Solution

People find it difficult to add, subtract, multiply A calculator program that people can install on their
and divide large numbers very fast. phones to help them with maths

People need to go to places, but they don't know A map program that can direct people anywhere from
how to find their way there. their phones, like Google Maps

People don't wake up early and they forget their A program that rings an alarm at a particuler time to
meetings and appointments? wake people up or remind them of appointments

Before you start solving a problem...


Unlike human beings, computers cannot understand what you are thinking about or figure out what is in
your mind unless you write out the instructions clearly. If the instructions you give a computer are
unclear, the computer won't know what to do.

hey robot, make


me a donut If you tell a robot to
make a donut without
telling it the steps
involved in making the
donut or the type of
donut you want, the
robot could get confused
because there are many
ways to make donuts and
many types of donuts.
The robot may not even
know what a donut is.

This is why every instruction given to the computer in a program or algorithm needs to be very clear,
simple and detailed so that it can be carried out without confusing the computer. Once the computer or
program is not sure of what to do, you will have a bug.

4 David Ogunshola
www.earlycodingbook.com
The process of solving problems
Whenever you have a task or big problem you want to solve or an idea for a computer program to
create you need to follow these four steps. They will help you to understand the problem works, and
with that, you can create a solution to it. In the end, you will have a list of steps that could be written
into a computer program.

If you follow these steps, you can always solve any problem, no matter how big and complex it looks.

Decompose Find the Patterns


Break down the big task or Look closely at the
problem into smaller bits or decomposed problem and
problems. individual pieces to identify
anything common between the
This is the first step in solving any small tasks.
problem. Once you can break a
problem into the small pieces that When you look closely, you will
make it up, you can easily notice something.
understand it.

Find the Create the


Connections Algorithm
Find out how these small Now that you know what you need
tasks or pieces are related to do, write down the steps
or connected together, and needed to put to small parts
how they join together to together to solve the big problem.
form the big task before it
was decomposed or to The algorithm could then be coded
solve the problem. into a computer program.

Problem
Program a robot to "feed the chickens"

Start by studying the problem or task to fully understand it.

The task may look big and complex, and if you just tell a robot, “feed the chickens” the robot could
get confused, especially if it is the first time.
There are many smaller questions that the robot needs to know before it can feed the chickens. For
example: where are the chickens? what do they eat? where is the food?

5 David Ogunshola
www.earlycodingbook.com
Events
What makes other things happen?

Things do not just happen by themselves, it is the same on


Events are actions that cause the computer. In every computer programs, before
other things to start happening. anything happens, there must be another action that tells
it to happen. These are what we call events.

When we are creating programs, we use events to tell the computer when to start doing something,
when to change what it is doing or when to stop doing something.

Events in everyday life


Imagine you walk into a dark room at night, you will want to turn on the lights. What do you do?
You tap on the light switch and the light bulb comes on. This is an example of an event and an action.

Event Action

In Computer Programming, every event triggers an action. You can


identify most events by the keyword WHEN.

When EVENT Perform ACTION

WHEN you are hungry, you look for something to eat.


WHEN you are thirsty, you drink water.
WHEN it is night, you go to bed.
On the computer, when you click on the mouse, press a key on your keyboard or touch an icon on your
screen, you expect the computer to respond by doing something. In programming, all these actions are
called EVENTS.

Event Action

When traffic light is RED

When traffic light is GREEN

10 David Ogunshola
www.earlycodingbook.com
Events in scratch
In Scratch and many other block programming languages, all events start with the word WHEN.

Every time you see a block that begins with the "WHEN", it can be used as an event. Every command or
script you attach to the event block will happen when that event is run.

To run an event means to start, activate or trigger the event.

The Event category contains the different events you can use to
start your program in Scratch. Event blocks are orange in color.

Scratch Events
Some of the popular events you will be using very often.

The When Flag Clicked event block starts your program


when the green flag on the stage is clicked.

When key pressed event allows you to


program any of the keys on the keyboard to
become your event.

Clicking on the arrow inside the button allows you to choose which key
or letter on the keyboard you want to make your event.
Every command you put under this event will run when that key is
pressed.

This code makes the sprite say


"hello" for two seconds whenever
the letter 'k' is pressed on the
keyboard.
Try it out

This event runs when the sprite is clicked. It is very useful


when you are creating programs to be used on tablets or
mobile phones.

11 David Ogunshola
www.earlycodingbook.com
loops
Making things happen again and again

A loop is a piece of code that makes an action to repeat itself over and over again.

Loops become useful when you have observed a pattern or you want to create a solution to a problem
that involves a pattern.

Remember the boy trying to cross the pathway with obstacles? If you are to create a program that
helps him cross the pathway, what will your code look like?

walk walk jump walk walk jump walk walk jump walk walk jump walk walk jump

1 2 3 4 5

Notice the pattern in the movement of the boy. He walks twice and then jumps. Because of this
pattern, he is repeating the same thing over and over again.

This is where a loop becomes useful. Instead of writing many lines of code to carry out each step,
you can use a loop to make the code repeat itself many times; in this example, the code will repeat
itself five times.

Loops in everyday life


There are loops in real life. We can observe many things that repeat themselves continuously.

The Days of the Week The Hours in a Day The Months in a year

The week starts on Sunday, ends The day operates in a cycle. January to December makes a
on Saturday and begins again. Every day has two 12-hour loops. full year, but when the year ends,
This process continues forever. The day begins at 12 midnight, it starts again. That is also a
The week runs in a loop. runs till 12 noon, and then goes to loop
12 midnight again.

16 David Ogunshola
www.earlycodingbook.com
Changing sprites with code
The Looks section of your code contains blocks and commands that can be used to change the
way your sprite looks when the program is running. A few important Look blocks you should get
familiar with are:

The switch costume block makes the sprite


change to any costume of your choice. You need to
know the name of the costume you want to
change to and select it by clicking the arrow.

The next costume block makes the sprite change to the next costume
on the queue in the order they are arranged.
If a sprite has five costumes, each time this block runs, it changes to
the next costume, and after the fifth costume, it goes back to the
first costume again.

The change size block makes the sprite become bigger or smaller
each time you run it. Using a positive number like 10 makes the
sprite bigger while using a negative number like -5 makes the sprite
become smaller.

The set size block returns the sprite back to its original size
when you use 100%. You can also use it to make a sprite bigger
and smaller in proportion to its original size.

The clear graphic effects block clears all changes


made to the sprite and return it to its original form.

Make a sprite walk


Costumes allow you to make a sprite actually walk across the
stage.
Using the Dinosaur Sprite, re-create the following script and
then click the Green Flag to see what it does.
Don't worry if you do not understand all the blocks of code
yet.

24 David Ogunshola
www.earlycodingbook.com
Representing Coordinates x-axis

The computer screen is represented by


numbers on both the x-axis and the y-
axis.
Every pixel sits on a point where the x-
axis and the y-axis meet. The coordinate
of that pixel is found by getting the
numbers on both the x and y axis and

y-axis
writing them together like this (x,y)
Coordinates are written as a pair of
numbers in parenthesis separated by a
comma like this (32,75). The first number
represents x while the second number
represents y.

x = -3, y= 0
coordinate = (-3,0) x = 1, y= 3
coordinate = (1,3)

Study these examples to understand how x = 4, y= -3


coordinates are identified. coordinate = (4,-3)

Find the coordinates


Using the method you've seen, find the coordinates of pixels A to F below and write them in the
table

B
Pixel Coordinate

A
B

E C

D
D

F E
C
F

29 David Ogunshola
www.earlycodingbook.com
Moving Sprites Up and Down
In Scratch, the stage is 480 steps wide and 360 steps high.
This means that the y-axis is 480 and the x-axis is 360.
The middle point of the screen is usually represented by (0,0), meaning x=0 and y=0.
This also means that half of each is axis is positive while the other half is negative

480 steps along the x-axis

180
360 steps along the y-axis

-240 240
0

-180

This means that when the y coodrinate of a sprite is on -240, it is on the extreme left of the
screen and when its x coordinate is on 180, it is at the extreme top of the screen.

To move a sprite on all directions on your screen, you will need the change x and change y blocks.
Y

+Y

X
-X +X
X
To move Up, change y by a positive number like 10
To move Down, change y by a negative number like -10
To move Right, change x by a positive number like 5
To move Left, change x by a negative number like -5
-Y

31 David Ogunshola
www.earlycodingbook.com
coding with sound
Using Voice, Music and Sound Effects in Scratch

Sound makes your programs or animations come alive and become more fun to interact with.
Without sound effects, video games will be boring, but you can use sounds to make whatever you
create enjoyable for the users.

When creating a game, you can add a sound whenever the player hits a coin, scores a goal or loses a
life. You can also play a sad sound when the player loses the game or a cheering sound when the
game is won.

Add this script to the cat sprite and click


on the cat to see what happens

Getting sound into your program


There are three ways you can get sound into your Scratch program.
Sounds in the Scratch Library: here, you can choose from the many sounds
You can manage
that come with the Scratch program. You can find sound effects for almost sounds from the
any program from the library sound tab

Upload sound from your computer: you can import any sound, music or audio
from your computer or from any device into scratch.
Record your voice: you can talk, and scratch will record everything you say
and use it in your program.

Upload sound from your computer

Record your Voice


Choose from the Sound Library

Place your mouse over this


button for the options to appear

35 David Ogunshola
www.earlycodingbook.com
Project: fruit catcher game
In this project, you will create a game where
fruits fall randomly from the sky, and a player
controls a bowl with which they can catch
fruits and earn points, but if the fruit falls to
the ground, they lose.

Thinking about it at first, the game may look


complex, but when you apply the process of
Computational Thinking, you will be able to
create the game step-by-step, with ease.

First, Decompose it
Break down the game into small tasks,
then try to solve them one by one.
Tasks:
1. Create the environment Start a new project
2. Choose your sprites 1
If you had any project you were working on earlier,
3. Make the fruits fall from the sky you will need to save it and start a new project
4. Make the player move the plate that has no code.
5. Determine when the fruit is caught or Remember to delete the cat sprite that comes
when it falls to the ground with every new project.
6. Add a score
7. Add sound effects Create the environment
2
The environment is determined by the
backdrop. So select a backdrop to
make your stage look like a good place
3 Choose your sprites to play the game.
Add the Apple sprite and the Bowl
sprite to the stage. Add a backdrop called "Blue Sky". You
can add backdrops by clicking this.
You might need to change their sizes:
make the size of the apple to be 75 and
the bowl to be 150.

4 Make the fruit fall from the sky 5 Add a sprite to be the
ground
Using a forever loop, you can Add the Line sprite and move
make the sprite fall from top to it to the bottom of the
bottom. But there is a problem. stage. That way, when the
The fruit stops once it gets to apple touches the line, we
the bottom of the stage. know it is on the ground.
We need to find a way to let the You will need a sensing
fruit know that it has reached condition to know when the
the bottom and then start apple is touching the ground.
falling from the top again.

39 David Ogunshola
www.earlycodingbook.com
Create your own animated stories
Under the Sea
Story:
Nemo and his friend starfish are
swimming randomly in the sea. There is a
shark who is also swimming randomly.
When the shark hits or runs into any of
them, he eats them up and they
disappear.

Add music that plays once you start the


story and never stops until you end the
program.

Scrambled
Blocks
These are some of the
blocks you will need, but
they are scrambled. Use
these blocks to create the
project described in the
story. Feel free to add
your own blocks too.

The Scary Bat


Story:

A dog is in the forest having a walk and


enjoying himself when suddenly after
about 10 seconds a bat appears and
makes a scary sound. The dog hears the
sound, gets scared and runs away.

Scrambled
Blocks
These are some of the
blocks you will use. Use
them, and any others you
need to create the story in
Scratch.

41 David Ogunshola
www.earlycodingbook.com
Digital Citizenship

your digital footprint


How important are the places you visit online?

Your Digital Footprint is a record of everything you do online including the websites
you visit and things you share.

Have you ever walked on the wet floor without shoes on? You leave a
footprint behind that makes it possible to know that you have been there.
Even when you wear shoes, the sand leaves marks of your footprints.

Every time you go online, search the internet, visit a website, chat with a
friend, watch a video or play a game online, you leave a trail. They are
called digital footprints.
It is possible for someone to find out a lot about you, the things you like,
the things you say and even the things you are learning just by observing
your digital footprints. The more time you spend on the internet, the more
footprints you leave behind, and your digital footprints are permanent, it
is very difficult to erase them.

Should you stop visiting the internet?


You do not need to stop using the internet because you are afraid of leaving your footprints behind;
instead, you should be careful to only go to the right places and do only the right things while online.
There are many fun things you can do online. You can learn new things, read amazing stories, meet new
people and see new places. but you should not share information about yourself without the permission
of an adult and you should be careful not to say mean or nasty things to people because those things
remain there as your footprints and even if you did not mean them, someone will see them and think you
are a bad person.

Let your digital footprints be CLEAN, RESPONSIBLE and RESPECTFUL.

Play Digital Detective


Two friends, Felix and Joe have been spending time online visiting a
website where they get to share information about themselves
and make new friends. You are a detective and you want to find
as much information about both of them.
You will examine their digital footprints and let us see how much
information you are able to gather about each of them.

46 David Ogunshola
www.earlycodingbook.com
Felix & Joe's Digital Footprints
These are the things they both share on the internet

My name is Felix
Ubong, I am 13 Hi there, my name
years old and I live is Joseph, but you
with my parents on can call me Joe.
23 Utuk Street,
Uyo in Nigeria.

I love to dance,
swim and play the
I have an iPad and guitar.
I love to play candy
crush. My email
address is
[email protected].

My big sister Ada


is always on her I have a dog called
phone and does not Max and my
like to play with me. favourite food is
Her phone number fried plantain.
is 023847689 and
she attends Brainy
Hive Schools.

Answer the following questions based on their digital footprints


Whose full name and age does everybody know?

If someone wants to steal from both of them, whose house can they find?

Who has revealed the identity of a member of their family?

Who do you think has a safer and more responsible digital footprint?

What things did Felix say online that he should not have said?

47 David Ogunshola
www.earlycodingbook.com
Computer Programming, Digital Citizenship &
Analytical Thinking for Children

Operators

David Ogunshola
your learning journey

Graph Paper Programming Input & Output


Page 5 Page 9

Arithmetic DataTypes Variables


Operators Page 17 Page 11
Page 19

Working with Evaluation Sensing Data


Strings Operators
Page 21 Page 22 Page 24

Broadcasts Backdrops Conditionals


Page 33 Page 29 Page 25

Designing Making Passwords


Costumes Animations Page 41
Page 35 Page 37

Project Ideas
in Scratch Cyberbullying
Page 45
Page 47
input & output
What all computers have in common

Even though computers may look very different, they all work in the same way. Whether they are
hand-held computers, desktops, laptops, robots, industrial computers or chips that work in other
machines, all computers perform four basic operations, and that is what makes them computers.

Every computer takes data as input, either stores or processes it,


then outputs the results immediately or whenever it is needed.

Input Processing
Input is what a computer receives before it Processing is whatever a computer does with
performs an action. Computers need something input. If you record your voice in Scratch, it is an
to work with and cannot do anything until they input but when you use Scratch to change the
have received input from someone or from pitch or speed of the recorded voice, you are
another program. processing the input.
Input can come from a keyboard, a mouse, a You can input five numbers into the computer and
microphone, a camera or sometimes even our ask a program to add them up. The process of
body signals. adding the input is called processing.

Storage Output
When a computer receives input, it can either Output is when a computer sends out information
keep it to process later, or when it is done that has already been processed. Computers
processing the input, it can keep it to be used output information differently depending on what
some other time. they were designed to do. Outputs can be text,
photos, videos, sound, interactions or signals.
Keeping something in the computer is called
storage. Every computer must have a memory Sometimes, the output from one program can
where it stores things. serve as input to another computer or program.

9 David Ogunshola
www.earlycodingbook.com
graph paper programming
Practice programming without a computer

In this activity, you will be practising how to think in algorithms and follow algorithms. The activity
looks similar to Pathway Ninjas, but it will require more focus, concentration and thinking. This is an
unplugged activity, so you do not need a computer.

You will be programming a graph paper by following the steps listed in an algorithm, and in other
cases, you will study a programmed graph paper and write out the algorithm that was used to
program it.

This is a piece of empty graph paper This is a programmed graph paper

Commands for Graph Programming

Move one Move one Move one Move one Color the Shows where
square up square right square left square down square to start

In Forward Programming, you program the graph paper by following the steps given in the
algorithm in the right sequence. In Reverse Programming, you study the programmed graph paper
and then re-create the algorithm that was used to program it.

5 David Ogunshola
www.earlycodingbook.com
Variables
Where programs store information that change.

Sometimes your computer program needs to store some


information for a short while like when you are playing a game
A variable is a container and scoring points, the game needs to keep track of your
in your program which score. Programmers create containers where these types of
stores information that information are stored, they are called variables.
changes when your
program is running. Variables only store information or data when the program is
running. When the program ends, the container becomes empty
again.

Variables at work
Bob is playing a game called Ocean Stars in which he controls a fish to eat up as many star coins as
possible within an amount of time. Take a look at the two images below, the first was taken when Bob
was about to start the game, and the second was taken while he was playing the game.
Study the two pictures and list out the differences you observe.

What are the differences between the two images?

11 David Ogunshola
www.earlycodingbook.com
sensing data
There are many in-built variables in Scratch. These are variables you do not have to create because
they are part of the Scratch program, however, they contain information that changes in different
situations. The variables created by the programmer are orange-coloured, while the variables that
come with Scratch are blue-coloured.

In the Sensing category, all the blue colored variables can also be used as data for operators.

The ask block creates an input field for the user to


type a response. You get to create what question the
program will ask the user by typing it inside the block.

Whatever response the user types is stored in this in-


built variable called "answer"

The current variable allows you to choose the:


current year, e.g. 2022
current month
date
day of the week
current time, etc

Each of these will return a value which you can use in an operator.

The mouse x variable returns x value of the coordinate location of the mouse pointer.
As you move the mouse, the coordinate changes. This variable returns the location
whenever the mouse moves. mouse y returns the y value on the coordinate.

The distance to variable measures the distance between two sprites in


pixels or steps. If you put this block in a sprite's code and call for
distance to another sprite, it will return the number of steps between
the two sprites.

pick random is not really a variable, but it is an important block that


returns a random number between the two numbers you set.If you
pick a random number between 20 and 30, it will choose a number
and return like 24, 28 or 21

What other sensing blocks and in-built variables can you identify?

24 David Ogunshola
www.earlycodingbook.com
designing costumes
How to change sprite costumes to make them yours

Sometimes you want to use a sprite, but you don't like how it looks in the Sprites library. You may
want to modify it by changing its colour, look or shape. You may even want to create a new original
sprite that does not exist in the library. This is why there is a paint editor in Scratch. Select the
sprite you want to modify and click on the costume tab to open the editor..

Change color

The Select Tool


The Reshape Tool This flips the sprite to
look the other way.
Brush Eraser

Paint Fill
Text tool

Line Tool
Circle Shape

Square shape

The Select Tool


The select tool looks like a mouse-pointer. It is used for modifying
the location of a part of the sprite, changing its size or rotating it.
Click the select tool and click on any part of the sprite, a blue box
will appear around it, and the object can be moved by grabbing the
centre and moving the mouse. You can rotate by dragging the two
small arrows below the box. You can make the head of the cat
bigger, remove the body and turn the head.

35 David Ogunshola
www.earlycodingbook.com
strings in scratch
Operators in Scratch that work with strings

In Scratch, there are operators for working with strings. They are:

The join block in Scratch combines two or more


strings to become one.
This is also called Concatenation.

You can use this operator to join variables with


other strings.

Run this script to see how concatenation works.

How do you combine more than two strings?


How do you add spaces to separate
different words?

Did you know you can place a join


block inside another join block to
make it longer?

This operator returns the letter in a selected


position in a string, for example:
Letter 1 in apple is "a"
Letter 5 in apple is "e"

The length operator counts how many


characters are in a string and tells you the
number.

Knowing how to use these operators will enable you to become more
creative in your programming using Scratch.

21 David Ogunshola
www.earlycodingbook.com
conditionals
How computers make decisions

You will remember that we said computers are not smart and they cannot think like human beings.
They only follow instructions that they are given in a program. Have you ever wondered how
computers make decisions if they cannot think?

Computers use something called conditionals to make their decisions.

A conditional is a statement or instruction in a program


that will only happen when another statement is true.
Conditionals use the keyword IF

Condition Action

If it is raining, take an umbrella

Condition
Action

If today is a weekday, go to school

When programmers code with conditionals, they can set different actions for the computer to take
when different conditions are met. This makes it look like the computer is smart and knows what to
do under every condition. There are no smart computers, only smart programmers. Whenever you see
a computer behaving very intelligently, it is running a program built by a very smart programmer.

25 David Ogunshola
www.earlycodingbook.com
broadcasts
How sprites communicate without touching each other

A broadcast is a message that is sent by one sprite and can be received by every other sprite.

It's easy for sprites to know when they touch each other and you can write code to run when
two sprites touch. Sometimes you want sprites to communicate with each other without
touching themselves, this is where you will need to use broadcasts.

When one sprite sends out a broadcast message, the broadcast can be programmed to
become an event that triggers a script in another sprite. This is very useful in games and
animations.

Broadcast blocks are found under Events.

Using Broadcasts

The broadcast block sends out a specific message


which other sprites receive and can respond to.

Create the name of the


broadcast here. It can
be anything, like
GameStart or Scene3

When I receive broadcast is an event that uses a


broadcast to trigger a script. Every script under it will
remain inactive until the broadcast message is received.

The broadcast and wait block is similar to the


broadcast block, except that after it broadcasts, it
will wait for every script under the when I receive
broadcast event to run and complete before it goes to
the next block.

33 David Ogunshola
www.earlycodingbook.com
creating animations
Creating interactive stories with Scratch

Animation is the art of making objects appear to move on the computer.

Animation usually includes using images in a sequence to create motion that looks like a video and using
sounds to add effects or create a conversation. This is how cartoons are made. The objects and
characters you see in cartoons are sprites, but through animation, you can make them move, talk and
interact.

These are scenes from different animations created using Scratch

What makes a good animation?


1. A good story: Before you begin programming in Scratch, you must create a very good story first.
Just like every programming project requires planning before coding, creating animations also requires
that you take time to think about the story you want to tell. Some questions you should ask yourself
are:
- Will this be narration by just one sprite, or will different sprites be having a conversation?
- Is this for entertainment or information purposes?
- How do I want people to feel when they watch this animation?

2. Motion: Good animation will need to have sprites moving. You can't call a sprite standing in one place
talking to itself an animation. If you ever watched Tom & Jerry cartoons, sprites run, jump or even fly.

3. Conversation: there must be a conversation in good animations. You either get two or more sprites
to talk to each other, or you get a sprite to make a presentation or performance for the person
watching. The conversation can either be by voice or for the viewer to read.

4. Sound: without the right sound, your animation will be boring. You should use good sounds to keep
your animation alive and enjoyable.

5. Transitions: if you are telling a story, then the characters need to be moving from one scene to the
other. If you can make transitions look real , it will make your animation more enjoyable.

37 David Ogunshola
www.earlycodingbook.com
DON'T BE A CYBERBULLY
How we can all put an end to cyberbullying.

What is cyberbullying?
Cyberbullying
Bullying is when someone uses their power repeatedly Using digital devices, websites and the internet to
to hurt, harm or upset someone. People can be bullied intimidate, harm, and upset someone
physically or emotionally by calling them names or
saying things about them that hurt them or the
people around them. Bully
The person who is doing the bullying
Cyberbullying happens when someone uses the
internet to bully others. It is different from physical Target
bullying because: The person who is being bullied
1. It can happen anywhere and anytime making it
difficult for the target to hide or escape A Bystander
2. The bully can easily hide their identity so people A person who sees a bullying behavior and does not
don't know who they really are. do anything about it
3. Other people online can see what is happening
and either join in the bullying or do nothing about An Upstander
it. A person who sees a bullying behaviour and stands
up to defend the target

Why do people bully others?


People act or look different from them, and they are unhappy and resort to bully
Someone is jealous of another person and feels the way to get to them is to say mean things
Someone is angry or resentful toward another person for different reasons
People who have been bullied before may take out their anger by bullying others

What to do if you are being bullied


Ignore them. Cyberbullies feel important when they see that their messages hurt you
Take a screenshot of messages to keep as evidence to report
Report the bully using the reporting tools on the social media platform
Block the bully.
Talk to a friend or a trusted adult

What can be considered as cyberbully?


1. Sending mean texts or messages to people
2. Being rude or mean to someone in an online game or on social media
3. Spreading secrets, gossip or rumours about other people online
4. Pretending to be someone else to spread hurtful messages online so people think it is them doing it
5. Pranking people without thinking of how the prank will make them feel
6. Hacking into someone’s gaming or social networking profile
7. Posting pictures of people doing things they don't want others to see

45 David Ogunshola
www.earlycodingbook.com
passwords
How private information are protected Digital Citizenship

Anything that is private on your computer, phone or on the internet should be available to only you.
Other people should only be able to see the things you choose to share with them. To protect those
things that are private, you need to lock them in a place that only you can access.

This is why passwords were created.

A password is a secret combination of letters, symbols, and


numbers that you can use to restrict who can access something on
your device or the internet.
It is a secret word because nobody else should know it except you.

Examples of private information that people try to protect?

1. Messages and emails


You do not want everybody to see all your conversations with people because there could be some
very sensitive information in your email. This is why people lock their messages and emails with a
password.

2. Money
People can move money from their bank accounts using apps on their phones or computers. If anyone
has access to your phone and those apps, it means they can move money from your bank account to
their own. To protect your money and keep it safe, those apps are protected with passwords.

3. Access to a computer
Sometimes, you do not want people to use your computer without permission, so to restrict them
from powering your computer, you can protect it with a password.

What other things do people protect with passwords?


1.
2.
3.

How passwords work


When you set a password for a website or a device, any time someone tries to access it, the
computer asks them what the secret word is. If the person doesn’t know the secret word, then the
computer believes that you are not the one and does not open the information to them. If anyone
finds out or guesses your password, the computer will think you are the one and will open the
information to them. A password is like a key that you carry about in your mind.

41 David Ogunshola
www.earlycodingbook.com
Computer Programming and Game
Development for Beginners

Logic

Games
your learning journey

Flowcharts Logical Operators

Nested Loops Functions Truth Tables

Computer Game Design Game Planning


Games Elements Computational Thinking
for Game Design

Other Game Kodu Game Lab Creating Games in


Design Studios Scratch

Sharing & Publishing Mobile App Clickbait &


your Games Development Fake News

Digital Phishing Attacks


Responsibility & Online Scams
Flowcharts
Using symbols to represent algorithms

Flowcharts are a combination of symbols used by computer programmers to communicate the


process of executing an algorithm.

Every algorithm or program can be represented using a flowchart created by combining different
symbols. Flowcharts are created by the designers or architects of the program. It is used to
communicate to another programmer what they have in mind. Inside each symbol, the action to be
taken will be written.

When an algorithm has been converted to a flowchart, any programmer can easily understand what it
is supposed to do and can use any programming language to build the program that can be executed
by a computer.

Good programmers know how to create and how to interpret flowcharts.

Different Shapes in a Flowchart


Start or End
The oval shape represents either the beginning or end of
a program or an algorithm.

Process
The rectangle shape is used when there is an intruction
to carry out or something to do.

Decision
The diamond shape is used to represent decisions that
are usually boolean in nature.

Input or Output
The parrallelogram shows that the program is meant to
receive an input or display an output.

Arrows
Used to connect different shapes in the flowchart. It is
also called a connector

5 David Ogunshola
www.earlycodingbook.com
nested loops
Placing loops inside other loops

A nested loop is a loop that is placed inside another loop.

A nested loop has at least two loops with one


being the inner loop and one being the outer
loop.

We use nested loops when we want to solve a


problem in which there are at least two
patterns repeating themselves or when we
need to do two things repeatedly.

Inner loop

Outer loop

In a nested loop, the inner loop will run first, and when the inner loop is complete, the outer loop will also
run. For every time the outer loop runs, the entire inner loop will run again.

We use nested loops to repeat patterns that have other patterns in them.

Example of a nested loop


Take a look at this problem. The bee needs to move along each
line to pick each flower. Already there is a need for a loop here.
The activity of moving one step and picking a flower along the
same line can be performed with a loop. Then that entire activity
needs also to be repeated four times for each of the lines.

This is an example of a problem that requires a nested loop. The


inner loop will run every time the outer loop runs.

Problem Solution

13 David Ogunshola
www.earlycodingbook.com
functions
Creating blocks that don't already exist

A function is a block or sequence of code that only runs when it is called.

So far, whenever we need to run any script in our code, we have to join all the blocks that make it possible.
When we have some scripts that we want to use many times, instead of having to join many blocks over and
over, we can make it a function. Functions allow us to turn a script that may have 10 or 15 blocks of code
into just one single block.

This is how it works:


This script makes a sprite spin 360 degrees to the right. There
are 3 blocks of code here, and each time we want the sprite to
spin to the right, we would have to use these 3 blocks of code.

Imagine we are building a program where we would be needing to


spin the sprite at different times, it could get cumbersome having
to write this script again and again.

Instead of doing that we can make this script into a block, and give it a name. Whenever we call that
block, this script would run. That is how functions work and they are used in every programming
language.

In Scratch, functions allow us to create blocks that don't exist in the Scratch library.

What we have now done is that we created a new block called "Spin Right" and we defined it with regular
blocks of code. Now we can drag the block 'spin right' into our code, and each time Scratch gets to that
block, it would run the script we defined.

This is how functions work.

In Scratch, you can create functions under the My Blocks section.

15 David Ogunshola
www.earlycodingbook.com
Computer games
Creating awesome experiences

Computer games have become very popular, and children, young people and even adults love to play
games on their phones, tablets and computers.

Can you identify any of these games? Have you played any game that looks like them before?

If you can identify any of these games, write their names and describe how they are played.

Do you have a favourite game? Write the name of your favourite game and write out a few things that
make you love the game.

Game development is the process of creating and building your own computer games.

18 David Ogunshola
www.earlycodingbook.com
playability
What make a great game

Playability is the attribute of a computer game that makes people want to play it over and over
again.

There are games you just want to keep playing again and again without getting tired. Not all games are
that fun. Some games are boring and don't make you excited. A game has good playability when people
want to play it many times and they don't easily get tired of it. Sometimes, the game can be very simple,
but people love it. Such a game is said to have good playability.

Building a good game doesn't start with coding, it starts with planning

first, you need to


come up with an
idea for the game
next you take time to plan out all the
different components of the game

Before you start coding, you should have your entire game idea on a piece of paper. This will keep you
focused throughout the game development process

Components of a good game


If you want to create a game that has great playability, the following elements and components need
to be present in your game

Characters ​ Objects

Characters are the people in the game.


Objects are the things the characters
It could an animal, a princess, a racecar, or even interact with
just a simple bubble. When you play a game, the
character is the person you control as the player. Objects in games include stars, coins, obstacles,
health boosters, bullets, doors, keys and anything
To make your game more fun, you can add other that the player or other characters interact with.
characters such as enemies or competitors whom Objects generally have an attribute and can be
you need to defeat or run away from. They are also repeated or duplicated. For example, you can have
characters and in some games you can even give multiple coins, and each time you hit a coin,
them names. something happens.

David Ogunshola
www.earlycodingbook.com
Mechanics Rules

Mechanics are the things your characters can Rules are the guides for playing the game
do and how they interact with the objects.
The game's rules inform players what they’re
Think of them as the 'verbs' in your game. They allowed and not allowed to do. For example in a
include actions such as running, jumping, football game you are not allowed to touch the
shooting, flying, capturing, dodging or catching. ball with your hands. In a computer game, you
The mechanics are the things you program the cannot walk through walls or touch certain
player to be able to do. edges.

Goals World

The goals define what the player is trying to The world sets the environment in which the
achieve through the game. game is played.

Every game challenges the player to achieve The game can be played in space, under water,
something. The goal could be to escape an in a jungle or in a city. Determining where the
enemy, score as many coins as possible, win a characters would be is an important element of
race or survive for as long you can. Most games the game because it determines the feel and
have lots of small goals, such as unlocking doors atmosphere of the game. A game of aliens
to new levels or winning new vehicles or skills, all would best be played in space while a car race
in an attempt to achieve a bigger ultimate goal. could be played in a city or on roads.

Controls Difficulty Level


This defines the levels the player is required
The controls are how the player makes the to progress through before completing the
characters interact in the game. game

Each mechanic should have a control trigger A good game should not be too easy or too
that makes the player do something. Depending hard. Usually, it should start easy and as the
on the device you are building a game for, your player masters the rules and mechanics of the
controls ould be keyboards, mouse, joysticks, or game, the difficulty should increase. You can
just touching the screen. The games is more increase difficulty levels bu increasing the
playable when the player feels in complete speed of enemies or objects, making enemies
control of the character. more powerful or making it harder for the
player to score points.

David Ogunshola
www.earlycodingbook.com
games & emotions
Determining how people feel when they play your game

How do you feel every time you play your favourite game?

Do you know that the developer of that game planned and determined how you would feel each time you
played the game?

As a game developer, you can also determine how people feel when playing your game. Different
emotions you can design into your game include excitement, joy, fear, relaxation, pressure, sadness and
more.

When playing your game, the player is entering into a new world, one that you the designer created. The
atmosphere you create in this world will determine how the player feels inside this world. If players
enjoy the atmosphere of your game, they will want to come in again and again.

Ideas for creating a great game atmosphere and emotions


Start with a Story
Giving a background story before the game starts can help the player
understand the world in which the game is being played. It also helps them
understand the mission and develop an emotional attachment to the
mission. You can open your game with a short narration.

If you are designing an adventure game, you could tell a story of a village
being attacked and how the hero's family was kidnapped. Now the hero
(who is the player) is on a mission to rescue his family and save his village
from the enemies.

This story gives the player a sense of mission and an emotional attachment to the game. It is different
is you create the same game but without the story.

Sound Effects
Sounds can be used to add effects to your game that affect the players
feeling. For example, each time a player scores a coin, you can play a winning
sound. The sound of winning a coin will make the player to try to win more and
more coins. You can also add a scary sound when an enemy is around so that
the player can sense danger.

All these sound effects contribute to how much players enjoy your game.

David Ogunshola
www.earlycodingbook.com
Backgrounds
Backgrounds are helpful in creating and defining the world in which the game is being played. You can use
backgrounds to change scenes, atmospheres and general player feelings.

Check the following game backgrounds. How does each of them make you feel? Where does the
background make you feel that you are? In which of them will ou prefer to play a game?

Speed
Manipulating speed has a way of making the player feel a sense of danger or more excitement. If the
game is designed to make a player dodge or escape enemy arrows, the game can start with the arrows
coming slowly and are easy for the player to escape. You can increase the difficulty of the game by
making the speed of the arrows increase.

More speed sometimes means more fear. Adding an element of variable speed in a game makes the
experience feel real for the player and as the speed increases, the player emotions are also controlled.

Color and Graphics


Colours can be used to communicate a lot. Some colours can be used to make a player feel safe while
some other colors can be used to depict danger. How do you feel in these two worlds?

These two games have the same objects and platforms, but the colours in one make you feel like you are
in a cold snowy environment, while the other makes you feel like you are in a hot tropical environment.
The only difference between the two are colors.
David Ogunshola
www.earlycodingbook.com
MORE game ideas.
Attempt to create these games here

A chase game
In a chase game, one character chases after another
character who is controlled by the player. The goal of
the game is to make sure the player is not caught by
the chaser.

Ideas for increasing game difficulty could include


increasing the speed of the chaser or making him
smarter with each level.

An educational game
Create a game where the player answers questions and solves problems in topics such as maths, science,
geography, history or general knowledge. The idea of the game is to generate different questions
randomly and give the player a very short time to answer the questions. The player scores a point for
every question they answer correctly and lose a point when they either answer wrongly or the time for
the question elapses.

A space fight game


In a space fight game, two players are fighting each
other with bullets or missiles. Whenever a bullet hits
the opponent, their health level reduces and after a
level, they lose a life. Be free to be creative with your
characters, story, mission and mechanics.

A football game
You can attempt to make a regular football game or
some other kind of sports that simulates the real
game.

30 David Ogunshola
www.earlycodingbook.com
game planning
How to design your game before you start coding

Before you begin the design of your game, use this worksheet as a guide to plan out your the different
aspects of your game.

Game Planning Worksheet


Game Idea
How would you describe the game you have in mind so that someone else can understand. At this stage
leave too much technical detail out, just focus on how someone will understand what you have in mind.

This is where you also define or include the mission of the game. For example;
The player is controlling a bat to ensure a randomly moving ball never touches the ground
The player controls a plate that catches apples falling randomly from the sky
The player is on a mission to kill all enemy aliens who are invading the planet

Characters Objects Mechanics


Who or what is the main
character the player will What objects will the What actions will the game
control. You can also mention characters interact with? need?
any other characters that will
be in the game. Coins? Bullets? Stars? Fruits? Examples: shoot, run, jump,
Balls? hide, slide
How many players will there
be? List all of them here

Rules Controls
Here you think about and define the rules for the game. What will be your controls?
E.g Define how the player will play
A player will have 5 lives the game.
The ball must not touch the ground
The enemy must not catch the player E.g
Players cannot walk through walls
Up Arrow = player move up
Be as creative as you can Space Bar = player hide
Key S = shoot

Difficulty Levels Variables How will the


What are the variables you'll game end?
You can describe how the be tracking in the game?
levels in the game will change.
e.g. Define the criteria for winning or
E.g. losing. Examples:
Lives Player loses when all lives are
After every 60 seconds, the Time lost
speed of the ball should Score Game ends after 300 seconds
increase Level and the player with the
Enemy Speed highest score wins

David Ogunshola
www.earlycodingbook.com
tinkering with
What is a Makey Makey?
Makey Makey is an invention kit.

It consists of a simple circuit board, alligator clips, and a USB cable. The circuit board allows
you to turn everyday objects into input devices used to control computers like your mouse or
keyboard by using closed-loop electrical signals.

Makey Makey is an extension in Scratch, but it works with a box of hardware that can be
purchased on the website www.makeymakey.com.

Makey Makey
What’s in the Box?
Board
Jumper wires

USB connector
Alligator wires

How Makey Makey works


When it comes to Makey Makey, your creativity is the only thing that can limit you. You can connect the
Makey Maley board to Bananas, cups of water, play-dough or any object that conducts electricity and
turn those objects into your computer keyboard.

Plug the Makey Makey board into your computer using the USB cable. Then use the alligator clips to
connect the Makey Makey to conductive objects you want to turn into your keyboard!
A conductor is any object that can transmit electricity from one point to another.
Makey Makey works well with Scratch. You can use Scratch to make a program and use Makey Makey
to turn everyday objects into event triggers and controllers.

38 David Ogunshola
www.earlycodingbook.com
cybersecurity
Keeping yourself and others safe online

Cyber Attacks
There is a lot of activity happening on the internet, including learning, playing, business, trading, banking
and more. There are also people online whose mission is to harm others for different reasons. They are
called attackers even though many people call them 'hackers'.

A cyber attack is when someone deliberately and maliciously attempts to breach the information
system of another individual or organization.

There are many reasons why people engage in cyber attacks, some reasons include:

1. To make money: some attackers steal people's information to sell or to hold and ask for a ransom
2. Hacktivism: to make a political or social point
3. Espionage: spying on a competitor or another country's data to gain an advantage
4. Intellectual Challenge: to prove that someone's security is weak. Also called 'white hat' hacking

Some types of Cyber Attacks


Phishing Attacks (pronounced: fishing): Phishing is when an attacker poses as a trusted person or
organization and sends you a personalized message asking you to click on a link or provide private
information.

Phishing attackers make the communication look like it is coming from a trusted source, but when you
click on the link, it takes you elsewhere, and the goal is to scam you. Most phishing attackers pretend to
be banks, schools, shopping companies, or even your employer.

Identity Theft: identity theft is a type of crime in which someone's private information is stolen and
used for criminal activity either on the internet or in real life.

Clickbait: An image or headline that tries to get you to click on it, usually for advertising purposes

Financial Scams: these are attacks carried out by scammers with the intention of stealing money from
other people. It includes attacks on people's banks to move money away, or scams made to make
someone pay money into another account through false presence.

Malware-based attacks: Malware refers to "malicious software" and it is designed to disrupt or steal
data from a device, computer network or server. Attackers trick users into installing malware on their
devices. The malware gives the attackers access to your sensitive data and they can steal sensitive
information.

Password attacks: these are types of cyber attacks in which hackers try to guess, steal, break or
trick users into giving them their passwords. The attacker then takes over the email of devices of the
victim.

41 David Ogunshola
www.earlycodingbook.com
Online copyrights
The rights and responsibilities that creators have

Who is a creator?
If you have ever created something original like writing a story or
poem, making music, taking a picture or video of something and
uploading it to the internet, then you are a creator.
Copyright
Also, it is very likely that you have used someone else's creation
online. Legal protection that creators have
over the things they create.
Everyone who creates anything has the protection of the law
that recognizes them as the owners. This is called copyright.
Anybody who wants to use something they create is supposed to
take a permission from them or refer to them as the owner.

Did you know?


It does not matter whether creative work is hard copy or digital, it is still protected by copyright. A
regular copyright symbol means you must get permission from the creator before you can use the work.

Important Vocabulary
Ownership of something you create, which gives you the right to determine how
Intellectual Property
others can use it.

To give credit to the person who created something, such as listing the author's name
Attribute
and the date, or a citation.

Copyright Legal protection creators have over the things they create.

Plagiarism Use of someone's creative work without attribution.

A clear way to define the copyright of a creative work, so others know how they can
License
use it.

Fair use is the copying or using of copyrighted material for a limited purpose without
Fair Use having to first acquire permission from the copyright holder. Such use could include
commenting, criticizing or other transformative purposes.

Before you use any work from the internet, ask:


What kind of copyright license does the creative work have?
Do I need to get permission from the creator to use it?
Have I provided attribution to the creator?

46 David Ogunshola
www.earlycodingbook.com
PYTHON
Suitable for Primary and
Secondary Schools

A Beginners Introduction to Python


Programming

Functions Variables Arrays

Loops Operators Conditionals

David Ogunshola
LEARNING JOURNEY

Meet Python Python Foundations


Script vs Interactive Mode

DataTypes Operators Working with


String, Arithmetic,
Evaluation & Logical
Variables

Errors & Bugs Functions Arrays & Lists

Tuples, Sets & Conditionals & Loops & Iterations


Dictionaries Decision Making

Working with Graphics with Problem Solving


Libraries Turtle with Python

Taking Python to Building Games


the next level with Python
welcome to python
The leading programming language in the world

What is Python?
Python is one of the leading programming languages in the world. It was created in 1991 by Guido van
Rossum. It is a high-level language, meaning the words and commands in Python are very close to human
language, making it easy to read, learn and understand.

What can you do with Python?


Python is a very powerful language and it can be used for many things including:
Creating software
Building websites
Performing mathematics operations
Analysing Data
Game Development
Artificial Intelligence
Machine Learning
Task Automation

There is a lot more you can do with Python. Some people even consider it one of the most powerful
programming languages today because of the variety of things you can do with it.

How to install python on your computer

Step 1
Open any browser on your computer
and visit the Python website and
click on the download menu.
Note that you must be connected to the
internet.

www.python.org

Step 2
Select the latest version of python and download the
installation fil for the laptop type you use. The installation
file for Windows laptops would be different from that for
Apple laptops.

Clicking the download button will save the installation file to your
computer

David Ogunshola
www.earlycodingbook.com
Step 3
Run the installation file on your computer. You can do this by double clicking on the installation file that
you downloaded from the python website.
This process will install the basic version of the Python interpreter on your computer, allowing you to use Python to code

Other Options
If you do not have access to the internet to download the Python file, you can ask your teacher or
parents to help you do that.
Someone else who has downloaded the installation file can share it with you through a USD drive. Be
sure that you are getting the correct file for your computer type. You cannot install a Mac file on a
Windows computer.

Running python from your computer


Once you have installed Python on your computer, you need to run it. Depending on how you installed it, you
may have an icon on your desktop that you can just double-click.

The easiest way to launch Python however is to go to the app launcher on your
computer and search for "IDLE" and select the app with the Python logo.

The Python IDLE will launch in a window


that looks like this. Depending on the
settings of your computer, it may look
white or black. Don't worry.

You can see the version of Python you


installed on the first line of the IDLE.

The line with the three arrows is where


you start typing your Python code from.

IDE vs IDLE
IDE means Integrated Development Environment. IDLE means Integrated Development & Learning
This is any software that provides a programmer with Environment.
all the tools and resources needed to write code and This comes bundled with Python and provides all the
build their software and apps. Examples of IDE's are functionality for you to code in Python but also helps you
VSCode, Eclipse, Android Studio etc. in learning because it explains what bugs you have,
IDE's are used by professional programmers. allowing you to correct your mistakes.

David Ogunshola
www.earlycodingbook.com
python IDLE
Getting familiar with how Python works

Before we start learning a lot about how Python works, let's get a little bit familiar with the Python IDLE

Your first Python program


Traditionally, the first program every programmer writes when learning a new programming language is
the Hello World program, which is basically getting the computer to display the words on the screen.

For our own first program, we would call it Hello Africa.

Open Python IDLE on your computer and type out the following code

>>> print ("Hello Africa") Python is case-sensitive. So if you wrote


Print with a capital P, you'll have a bug.

The response to that line of code you wrote is that the Python interpreter will write Hello Africa on a
new line, without quotation marks or the parenthesis. You will understand where all of them went shortly.
For now, you can try getting Python to write anything you want.

Using Python as a calculator


You can use your Python IDLE to perform mathematical operations just like you would do on a calculator.
If you need to do some calculations, just open Python and type them out. Try writing out the following
lines of code in your IDLE and see the responses

Write the responses to your code here


>>> 4 + 7

>>> 5 * 5

>>> 30 - 10

>>> 100 / 20

>>> 4 + 2 - 5 * 2

>>> 30 // 3

>>> 10 % 3

>>> 2 ** 5

David Ogunshola
www.earlycodingbook.com
datatypes
Knowing how to use data

Before a computer program can process data, it needs to know what type of data it is.

Datatypes are a way of classifying data so that the computer program knows how the programmer
intends to use the data.

Some popular datatypes


We would start by learning the most popular datatypes.

Datatype Definition Examples

2
Integers are whole numbers that have no
Integer 45
decimals or fractions
7560

Float 4.5
These are numbers that have decimals or
(also called Floating 2.0
fractions
Points) 34.876

A string is a sequence of characters like texts


"David"
and numbers that are taken together.
"Nigeria"
String
"Monkeys like bananas"
Strings are represented by putting them in
"76"
quotation marks " "

45 = 45
A boolean is a statement or expression which
Boolean Joseph is a boy
has a response that is either True or False.
Today is Friday

The DataType usually determines how the computer processes each value. For example, integers and
floats are numbers, so you can add, subtract or multiply them. If you try to multiply a string by a
string, there will be a bug.

Many programming languages will require you to specify what datatype every variable is supposed to
contain, so that the computer knows what can be done with the variable and what cannot be done.

David Ogunshola
www.earlycodingbook.com
Arithmetic operators
Operators for working with numbers

Arithmetic Operators are the symbols with which we can perform operations on number
DataTypes such as Integers and Floats. We do not use them on datatypes that are not numbers.

Most of the arithmetic operators are used similarly to the way they are used in Mathematics with
just a few new ones you may not be familiar with.

Operator Symbol What it does Example

This is used to add two numbers or


Addition + 4+5=9
variables together

Works just like in maths to subtract one


Sutraction - 10 - 5 = 5
value from the other

Works like normal division in maths to


Division / 30 / 10 = 3
divide one value by the other

Multiplication * Works just like multiplication in maths 3*3=9

This operator divides two numbers but only


20 // 6 = 3
Floor Division // returns the whole number without the
16 // 10 = 1
remainder or fraction

This operator returns only the remainder


20 % 6 = 2
Modulo % when two values are divided. It is the
16%10 = 6
opposite of floor division

This is the same as "raised to the power 3**3 = 27


Exponential **
of" in mathematics

The Floor Division and Modulo are the tricky operators. Let's explain them more.

Floor Division Modulo

20 // 6 20 % 6

When you divide 20 by 6, the answer is 3 When you divide 20 by 6, the answer is 3
with a remainder of 2. with a remainder of 2.

Floor division only takes the integer 3 Modulo only takes the remainder of 2
and discards the remainder. and ignores the main integer.

That is why 20 // 6 = 3 That's why 20 % 6 = 2

Floor division and modulo are actually like opposites.

David Ogunshola
www.earlycodingbook.com
EVALUATION OPERATORS
Operators used to compare values

Just like Arithmetic operators are used to perform operations on numbers, Evaluation operators
are used for comparing values.

Evaluation Operators are Boolean in nature, meaning each will return a value of either True or False.

There are 6 evaluation operators used across different programming languages.

Operator Symbol Description Example

>
Will be True if the value on the left is 5 > 3: True
Greater Than bigger than the value on the right, if 2 > 1: True
not, it will be False 6 > 10: False

3 < 4: True
<
Will be True if the value on the left is 200 < 500: True
Less Than smaller than the value on the right, if 50 < 45: False
not, it will be False

==
Will be True only if the value on the 5 == 5: True
Equal To left is the same as the value on the 25 == 25: True
right 100 == 70: False

>=
Greater than Will be True if the value on the left is 24 >= 20: True
either bigger than or the same as 50 >= 50: True
or Equal to the value on the right 33 >= 40: False

<=
Less than or Will be True if the value on the left is 40 <= 40: True
either smaller than or the same as 30 <= 40: True
Equal to the value on the right 30 <= 20: False

!=
Will be True only if the value on the 30 != 20: True
Not Equal to left and the value on the right are not 2 != 4: True
same as 7 != 7: False

22 David Ogunshola
www.earlycodingbook.com
Creating variables
Getting comfortable with making variables

The power of variables


Variables are like containers in your program where you store information that might change when you
are using the program or that will change when a different person is using the program.

For example, every time someone writes an exam, they will score a certain amount of marks. As a
programmer, you can create a variable called "score" which will store whatever marks the student gets.
Whenever you want to make a reference to the marks the student gets, you just use the name of the
variable and Python will get whatever score is inside it. It doesn't matter if different users have
different scores, you don't have to change the content of your variable every time.

Variables are a very powerful feature of programming languages, without them, programming would be a
tedious task.

How to create a variable

This is the name score = 56 This is the value


of the variable of the variable

The = symbol is called an assignment


symbol, it is used to create a variable
and assign a value to it

Every time you want to create a variable, just use the assignment symbol (=). The name of the variable is
on the left and the value of the variable is on the right. Think of it this way, the variable name is the
name of the container, and the value is what is inside the container.

Practice your understanding of variables by filling out this table


Variable Assignment Name of Variable Value of variable Datatype of variable

school = "Brainy Hive"

age = 12

country = "Nigeria"

myweight = 23.5

David Ogunshola
www.earlycodingbook.com
how to name variables
Rules and best practices for naming variables

As the programmer, you have the liberty to choose any name for your variables. The name could be
anything meaningful and could be as long as you want it to be, but there are some rules you need to follow
for naming variables in Python. If your variable name violates any of the rules, the variable is illegal and you
will have a bug.

Rules for naming variables


1. Variables names can contain both letters and numbers, but CAN NOT begin with a letter
2. Variable names CAN NOT have spaces
3. Variable names CAN NOT contain any special character EXCEPT the underscore (_)
4. You CAN NOT use any of the Python keywords as a variable name.

A variable name that does not violate any of the rules above is legal and will be accepted. Variable names
that break any of the rules will be considered illegal and cannot be used in Python.

Python Keywords
Python keywords are specially reserved words in Python that are used by the interpreter itself.

None of the Python keywords can be used as a variable because Python has already assigned another
meaning to them. If you try to create a variable with a keyword, you will get the following error

and del global not


as elif if or
assert else import pass
break except in raise
class False is return
continue finally lambda True
def for None try
with from nonlocal while
yield

David Ogunshola
www.earlycodingbook.com
Can you tell if these variable names are legal or illegal?
Variable Name Is it legal or illegal? If it is illegal, explain why

4matrix = 77

player-speed = 500

player_name = "Spiderman"

need4speed = "Let us do this"

distance_to_the_moon = 456343456

lives% = 34

my teacher = "Teacher Edidiong"

Choosing good variable names


If your variable name is legal, meaning it does not break any of the Python rules, it will be accepted.
However, not every legal variable name is a good name.

Check out the following legal variable names. Which of them makes sense to you?

>>> rhesusjuu = "55 Adeniyi Street"


>>> termiteflowiconbuy = "Ibadan"
>>> phone_number = 08828726

1. Choose a name that has a meaning close to the purpose of the variable. Names like age, surname,
firstname are variable names that can help another programmer know what you meant to do
with them.
2. While it's okay to use both UPPERCASE and lowercase, it is best to make longer variables
readable. You can do that either by separating words with an underscore or b using camel case.

Camel Case Variables Underscore Variables


MyAge my_age
StudentName student_name
NumberOfLives number_of_lives

David Ogunshola
www.earlycodingbook.com
modules & LIBRARIES
Accessing functions that have been created by others

A module is a file that contains a set of pre-defined functions that are related to each other.
A library is a collection of modules.

Modules and Libraries are similar to each other because they give the programmer a large collection of
already-created functions that makes programming easier and faster.

The functions in a module or library cannot be assessed directly by your program or by the Python IDLE. For
you to use them, you need to first import them.

When you import a module or library, you can then make use of all the functions it contains.

Importing a module
Python has many modules that contain a lot of helpful functions that perform many operations that enable
you to build programs faster.

To import a module, just write import and the name of the module.
To see the complete list of all modules in Python, write help('modules')
This code will display a list of all
>>> help('modules') Python in-built modules

Using a module: let's work with Math


Python has a math module that contains functions that perform most of the mathematical operations you
may need for calculations. Rather than doing your calculations manually, you can import the math module and
then call those functions to perform operations for you.

>>> import math

When you run that code in your IDLE and there is no response, it means the module was successfully
imported. Now you can call any function that comes with the math module.

To display all the available functions in a module, just write write dir(module_name)

>>> dir(math)

This would list out all the functions in a list, but it doesn't explain what each of the functions does.
You can get help about every function in a module, write help(module_name.function_name)

This code would explain what the log function in


>>> help(math.log) the math module does.

28 David Ogunshola
www.earlycodingbook.com
arrays and indexes
Working with data sets and collections

Storing collections of data


All the datatypes we have learned about so far only contain one value or piece of data at a time. For
example, an integer is just a single number, and a float is also a number. There are times when you may need
to store a collection of data as a single variable like when you want to store the names of all the students
in a class or the scores of all the students in that class in their maths test, yet you want the entire
collection to be a single variable. These types of collections of data are generally called arrays.

Python has four types of arrays or datatypes that are used for storing collections of data. They are:
1. List
2. Tuple
3. Set
4. Dictionary

All four of them have their unique differences which you would learn as you progress.

The index of an array item


Each item in an array has a unique position with which we can identify it. This position is called the index
of the item and it is represented by a number.

In programming generally, we start counting our indices from the number zero (0) and not from the
number one (1). So the first item in an array has an index of zero.

Array item:

Index of item: 0 1 2 3 4

>>> myclass = ["David", "Ada", "Ibrahim", "Eze", "Okon", "Bola"]

We can identify or call a particular item in a list by calling the name of the variable and the index in the
square bracket . In the first list we created:

myclass[0] = "David"
myclass[1] = "Ada"
myclass[2] = "Ibrahim"

Negative indexing
Python also allows you to call or reference array items from the end. We use negative indexing to achieve
this. Just like the first item in an array has an index of 0, the last item in the array has an index of -1.
The second to the last item has an index of -2, and it continues that way.
myclass[-1] = "Bola"
myclass[-2] = "Okon"

32 David Ogunshola
www.earlycodingbook.com
iteration: FOR LOOPS
Iteration, looping and repetitions

Iteration is the process of repeating steps. A loop is a piece of code or sequence of


instructions that is continually repeated a
number of times or until a certain condition
is reached.

Iterations are like patterns that require you to do the same thing again and again.

For example, if you want to calculate the total score in Social Studies for 15 students in a class. You need
to add the test score and the exam score to get the total score. You will have to perform that same
operation for each of the 15 students in that class to be able to have everybody's total score. That's an
iteration - you are performing the same task, but doing it multiple times.

Whenever you need to solve a problem that requires an iteration, then you need to use a loop.

In most text-based programming languages, there are two popular types of loops:
FOR LOOP
WHILE LOOP

For Loop
A for loop is used for iterating over a sequence which could be a list, tuple, set, dictionary or even a
string.

The for loop allows you to execute a set of statements once for each item in a list or sequence. For
example, if you have a list of students and want to print a statement for each student, you can use a
for loop.

The general sequence of the for loop looks like this:

>>> runners = ["Bolt", "Blake", "Powell"]


>>> for x in runners:
print(x)

The list runners is the iterator, x is just an indexing variable and could be replaced with anything.
Also pay attention to the colon and the indentation.
An object is said to be iterable if it is possible to run an iteration on it. If the items in the object can
be converted to an array, then it is iterable. Generally, a string is also iterable because the
characters in a string can be turned into an array.

Many of the operations you can perform on lists can also be performed on strings.

37 David Ogunshola
www.earlycodingbook.com
show your skills
Programming challenges for you to solve

Your challenge as you learn to code in Python is to be able to solve all the problems on this list. As you learn
more and develop your skills, always come back to the problem list to see if you are able to solve a new
problem. Once you have successfully solved a problem, tick off the "solved" box.
The goal is to be able to solve every problem on this list.

Challenge Solved

Write a function called reverse() that takes a string as an argument and rewrites it
1
backwards. E.g you pass "hello" the function and it returns "olleh"

Create a function that asks the user for two numbers and prints out the sum,
2
difference, product, and quotient of those numbers.

Create a program that takes a list of numbers and returns the sum of all the even
3
numbers in the list.

4 Create a program that takes a list of strings and returns the longest string in the list

Write a function that calculates the factorial of a given number.


5 Factorial means to multiply each number by the number-1 till it gets to 1.
5 factorial = (5 * 4 * 3 * 2 * 1)

Write a program that generates a random number between 1 and 100 and asks the
6 user to guess it. The program should provide feedback on whether the guess is too
high or too low until the user guesses correctly.

Write a function that takes a list of integers and returns a new list with all the duplicate
7
values removed.

Write a function that takes a list of strings and returns a new list with all the vowels
8
removed from each string.

Write a program that calculates the sum of all even numbers between 1 and a given
9
number.

Write a calculator program that asks a user to enter two numbers, select what
10
operation they want to perform on it and it returns the answer.

Create a password generator function that suggests a password for a user that meets
11 the requirements of having 8 characters, has both numbers and letters and special
characters.

12 Create a Python function that tells the current time and date each time you call it.

Share your codes, post your challenges and connect with other programmers in our online coders
community.
www.earlycoding.online/community

48 David Ogunshola
www.earlycodingbook.com
Additional Support
Teacher's Training &
Certification
We have developed a training and certification program that equips
teachers to use Early Coding for Kids books and curriculum to teach
learners of all ages.

Trained teachers gain access to our exclusive library of lesson slides


prepared for each lesson, available only on the educators
community.

Training Options
Online Version; Link on the book website
Offline Version: available on demand, for a minimum of 50 persons

Complimentary Training: Schools get FREE training for 1 teacher for every 250 books bought
Place Your Orders

Online
www.earlycodingbook.com

Other Books in the Series


Level 1: The Foundations of Computer Programming
Level 2: Computational Thinking & Coding with Scratch
Level 3: Coding & Animations with Scratch
Level 4: Principles of Game Development
Level 5: Coding with Python: Beginners
Level 6: Web Development for Beginners: HTML and CSS
Level 7: Coding in Python: Advanced
Level 8: Data Science for Beginners: SQL

Phone + WhatsApp
+2349036559150 | +2348077544056
Africa's leading coding and startup school for children
...on a mission to lower the age of innovators in Africa

We teach coding and entrepreneurial


skills to children aged 5-16, positioning
each student to launch their first
startup before their 18th birthday

www.earlycoding.online

You might also like