Hello World!
Computer Programming for Kids and Other Beginners
Warren D. Sande and Carter Sande
  • March 2009
  • ISBN 9781933988498
  • 432 pages
  • printed in black & white
This title is out of print and no longer for sale.

Computer programming is a powerful tool for children to 'learn learning'...Children who engage in programming transfer that kind of learning to other things.

Nicholas Negroponte, One Laptop Per Child Project, January 2008

Second edition of this book is available

Your computer won't respond when you yell at it. Why not learn to talk to your computer in its own language? Whether you want to write games, start a business, or you're just curious, learning to program is a great place to start. Plus, programming is fun!

Hello World! provides a gentle but thorough introduction to the world of computer programming. It's written in language a 12-year-old can follow, but anyone who wants to learn how to program a computer can use it. Even adults. Written by Warren Sande and his son, Carter, and reviewed by professional educators, this book is kid-tested and parent-approved.

You don't need to know anything about programming to use the book. But you should know the basics of using a computer--e-mail, surfing the web, listening to music, and so forth. If you can start a program and save a file, you should have no trouble using this book.

Table of Contents show full



About this book

1. Getting Started

Installing Python

Starting Python with IDLE

Instructions, please

Interacting with Python

Time to program

Running your first program

If something goes wrong

Your second program

2. Remember This — Memory and Variables

Input, processing, output


What’s in a name?

Numbers and strings

How "variable" are they?

The new me

3. Basic Math

The four basic operations


Order of operations

Two more operators

Really big and really small

4. Types of Data

Changing types

Getting more information: type()

Type-conversion errors

Using type conversions

5. Input


The print command and the comma

Inputting numbers

Input from the Web

6. GUIs — Graphical User Interfaces

What’s a GUI?

Our first GUI

GUI input

Pick your flavor

The number-guessing game…​ again

Other GUI pieces 60

7. Decisions, Decisions

Testing, testing


Am I seeing double?

Other kinds of tests

What happens if the test is false?

Testing for more than one condition

Using "and"

Using "or"

Using "not"

8. Loop the Loop

Counting loops

Using a counting loop

A shortcut — range()

A matter of style — loop variable names

Counting by steps

Counting without numbers

While we’re on the subject…​

Bailing out of a loop — break and continue

9. Just for You — Comments

Adding comments

Single-line comments

End-of-line comments

Multiline comments

Commenting style

Commenting out

10. Game Time


11. Nested and Variable Loops

Nested loops

Variable loops

Variable nested loops

Even more variable nested loops

Using nested loops

12. Collecting Things Together — Lists

What’s a list?

Creating a list

Adding things to a list

What’s the dot?

Lists can hold anything

Getting items from a list

"Slicing" a list

Modifying items

Other ways of adding to a list

Deleting from a list

Searching a list

Looping through a list

Sorting lists

Mutable and immutable

Lists of lists: tables of data

13. Functions

Functions — the building blocks

Calling a function

Passing arguments to a function

Functions with more than one argument

Functions that return a value

Variable scope

Forcing a global

A bit of advice on naming variables

14. Objects

Objects in the real world

Objects in Python

Object = attributes + methods

What’s the dot?

Creating objects

An example class — HotDog

Hiding the data

Polymorphism and inheritance

Thinking ahead

15. Modules

What’s a module?

Why use modules?

Buckets of blocks

How do we create modules?

How do we use modules?


Standard modules

16. Graphics

Getting some help — Pygame

A Pygame window

Drawing in the window

Individual pixels


Let’s get moving!


Smoother animation

Bouncing the ball

Wrapping the ball

17. Sprites and Collision Detection


Bump! Collision detection

Counting time

18. A New Kind of Input — Events


Keyboard events

Mouse events

Timer events

Time for another game — PyPong

19. Sound

More help from Pygame — mixer

Making sounds versus playing sounds

Playing sounds

Controlling volume

Repeating music

Adding sounds to PyPong

More wacky sounds

Adding music to PyPong

20. More GUIs

Working with PythonCard


Making our GUI do something

The return of event handlers

Moving the button

More useful GUIs


What’s on the menu?

21. Print Formatting and Strings

New lines

Horizontal spacing — tabs

Inserting variables in strings

Number formatting

Strings 'n' things

22. File Input and Output

What’s a file?


File locations

Opening a file

Reading a file

Text files and binary files

Writing to a file

Saving your stuff in files: pickle

Game time again — Hangman

23. Take a Chance — Randomness

What’s randomness?

Rolling the dice

Creating a deck of cards

Crazy Eights

24. Computer Simulations

Modeling the real world

Lunar Lander

Keeping time

Time objects

Saving time to a file

Virtual Pet

25. What’s Next?

General programming


Game programming and Pygame

Other Python stuff

Look around

Appendix: Variable Naming Rules

Answers to Self-Test Questions


About the Technology

Though the concepts and ideas presented apply to any programming language, Hello World! uses the easy to learn Python programming language. Python is free, and is available for different platforms, including Windows, Linux, and Mac. Hello World! covers all the basic concepts of computer programming, including memory, looping, decisions, input and output, data structures, graphics, and many more. It then applies them to fun, interesting topics like computer graphics, game programming, and simulations.

What's inside

  • Makes programming fun and easy to learn
  • Explains concepts in clear language—no "geek speak"
  • Lots of pictures, cartoons, and fun examples to hold your interest
  • Complete set of fully-worked questions and examples make it great for use by yourself or in a classroom

About the reader

Hello World! makes computer programming accessible and fun for kids, which is essential in today's hi-tech world. It can be used at home or in a classroom setting.

About the authors

Warren Sande is an Electronic Systems Engineer who uses Python (and other languages) in his work, and also uses it to help teach his son about computers and programming. He holds a degree in Electronic Systems Engineering from the University of Regina, Saskatchewan, as well as a Diploma in Communication Arts, specializing in Broadcasting, from the Southern Alberta Institute of Technology. He has taught introductory software courses to computer novices. He has written many readable and user-friendly technical documents in his engineering work.

Carter Sande is a bright, curious, energetic, and thoughtful boy who loves computers, playing the piano, bouncing on the trampoline, and Mario. He has been playing and experimenting with computers from a young age.