Hello World! Third Edition
Computer Programming for Kids and Other Beginners
Warren Sande and Carter Sande
  • November 2019
  • ISBN 9781617297021
  • 496 pages
  • printed in color
free previous edition eBook included
An eBook copy of the previous edition of this book is included at no additional cost. It will be automatically added to your Manning Bookshelf within 24 hours of purchase.

A highly engaging approach that introduces kids to programming using Python.

Ben McNamara, DataGeek

Hello World! Computer Programming for Kids and Other Beginners, Third Edition introduces the world of computer programming in a clear and fun style using Python, a programming language designed to be easy to learn.

About the Technology

Learn to talk to your computer in its own language! Whether you want to create a game, start a business, or solve an important problem, the first step is learning to write your own programs.

About the book

Hello World! Computer Programming for Kids and Other Beginners, Third Edition introduces the world of computer programming in a clear and fun style. Using Python, a programming language designed to be easy to learn, each engaging lesson teaches skills that apply to any kind of programming. It brings to life the basic concepts of computing—looping, decisions, input and output, graphics, and more.

Written by father-and-son team Warren and Carter Sande, this international bestseller is kid-tested and reviewed by professional educators. Now in its third edition, Hello World! has been fully updated to Python 3 and includes a new chapter about how the internet works.

Table of Contents detailed table of contents

1. Getting Started

1.1. Installing Python

1.2. Starting Python with IDLE

1.3. Instructions, please

1.3.1. If it doesn’t work

1.4. Interacting with Python

1.5. Time to program

1.6. Running your first program

1.7. If something goes wrong

1.7.1. Syntax errors

1.7.2. Runtime errors

1.8. Our second program

1.8.1. What did you learn?

1.8.2. Test your knowledge

1.8.3. Try it out

2. Remember This: Memory and Variables

2.1. Input, processing, output

2.2. Names

2.3. What’s in a name?

2.4. Numbers and strings

2.4.1. Long strings

2.5. How “variable” are they?

2.6. The new me

2.6.1. What did you learn?

2.6.2. Test your knowledge

2.6.3. Try it out

3. Basic Math

3.1. The four basic operations

3.2. Operators

3.3. Order of operations

3.4. Integer division: Quotient and remainder

3.5. Exponentiation: Raising to a power

3.6. Increment and decrement

3.7. Really big and really small

3.7.1. E-notation

3.7.2. Exponents vs. E-notation

3.7.3. What did you learn?

3.7.4. Test your knowledge

3.7.5. Try it out

4. Types of Data

4.1. Changing types

4.1.1. Changing an int to a float

4.1.2. Changing a float to an int

4.1.3. Changing a string to a float

4.2. Getting more information: type()

4.3. Type-conversion errors

4.3.1. What did you learn?

4.3.2. Test your knowledge

4.3.3. Try it out

5. Input

5.1. input()

5.2. Putting the input on the same line

5.2.1. A shortcut for input() prompts

5.3. Inputting numbers

5.3.1. Using int() with input()

5.4. Input from the web

5.4.1. What did you learn?

5.4.2. Test your knowledge

5.4.3. Try it out

6. GUIs: Graphical User Interfaces

6.1. What’s a GUI?

6.2. Our first GUI

6.2.1. Let’s get GUI-ing

6.3. GUI input

6.4. Pick your flavor

6.4.1. Dialog box with multiple buttons

6.4.2. Choice box

6.4.3. Text input

6.4.4. Default input

6.4.5. What about numbers?

6.5. The number guessing game …​ again

6.6. Other GUI pieces

6.6.1. What did you learn?

6.6.2. Test your knowledge

6.6.3. Try it out

7. Decisions, Decisions

7.1. Testing, testing

7.2. Indenting

7.3. Am I seeing double?

7.4. Other kinds of tests

7.5. What happens if the test is false?

7.6. Testing for more than one condition

7.7. Using and

7.8. Using or

7.9. Using not

7.9.1. What did you learn?

7.9.2. Test your knowledge

7.9.3. Try it out

8. Loop the Loop

8.1. Counting loops

8.1.1. Runaway loops

8.1.2. What are the square brackets for?

8.2. Using a counting loop

8.3. A shortcut: range()

8.4. A matter of style: Loop variable names

8.4.1. A range() shortcut

8.5. Counting by steps

8.6. Counting without numbers

8.7. While we’re on the subject …​

8.8. Bailing out of a loop: break and continue

8.8.1. Jumping ahead: continue

8.8.2. Bailing out: break

8.8.3. What did you learn?

8.8.4. Test your knowledge

8.8.5. Try it out

9. Just for You: Comments

9.1. Adding comments

9.2. Single-line comments

9.3. End-of-line comments

9.4. Multiline comments

9.5. Triple-quoted strings

9.6. Commenting style

9.7. Comments in this book

9.8. Commenting out

9.8.1. What did you learn?

9.8.2. Test your knowledge

9.8.3. Try it out

10. Game Time

10.1. Skier

10.1.1. Try it out

11. Nested and Variable Loops

11.1. Nested loops

11.2. Variable loops

11.3. Variable nested loops

11.4. Even more variable nested loops

11.5. Using nested loops

11.6. Counting calories

11.6.1. What did you learn?

11.6.2. Test your knowledge

11.6.3. Try it out

12. Collecting Things Together: Lists and Dictionaries

12.1. What’s a list?

12.2. Creating a list

12.3. Adding things to a list

12.3.1. What’s the dot?

12.3.2. Lists can hold anything

12.4. Getting items from a list

12.4.1. Why does the index start at 0, not 1?

12.5. “Slicing” a list

12.5.1. Slice shorthand

12.6. Modifying items

12.7. Other ways of adding to a list

12.7.1. Adding to the end: append()

12.7.2. Extending the list: extend()

12.7.3. Inserting an item: insert()

12.7.4. The difference between append() and extend()

12.8. Deleting from a list

12.8.1. Deleting with remove()

12.8.2. Deleting with del

12.8.3. Deleting with pop()

12.9. Searching a list

12.9.1. The in keyword

12.9.2. Finding the index

12.10. Looping through a list

12.11. Sorting lists

12.11.1. Sorting in reverse order

12.11.2. Another way to sort: sorted()

12.12. Mutable and immutable

12.12.1. Tuple: An immutable list

12.13. Lists of lists: Tables of data

12.13.1. Getting a single value from the table

12.14. Dictionaries

12.14.1. A bit more about dictionaries

12.14.2. What did you learn?

12.14.3. Test your knowledge

12.14.4. Try it out

13. Functions

13.1. Functions: The building blocks

13.1.1. Creating a function

13.1.2. Calling a function

13.2. Passing arguments to a function

13.2.1. Functions with more than one argument

13.2.2. How many is too many?

13.3. Functions that return a value

13.3.1. Returning a value

13.4. Variable scope

13.4.1. Local variables

13.4.2. Global variables

13.4.3. Forcing a global

13.5. A bit of advice on naming variables

13.5.1. What did you learn?

13.5.2. Test your knowledge

13.5.3. Try it out

14. Objects

14.1. Objects in the real world

14.2. Objects in Python

14.2.1. What are attributes?

14.2.2. What are methods?

14.3. Object = attributes + methods

14.4. Creating objects

14.4.1. Creating an instance of an object

14.4.2. Initializing an object

14.4.3. A “magic” method: str()

14.4.4. What’s self?

14.5. An example class: HotDog

14.6. Hiding the data

14.7. Polymorphism and inheritance

14.7.1. Polymorphism: Same method, different behavior

14.7.2. Inheritance: Learning from your parents

14.8. Thinking ahead

14.8.1. What did you learn?

14.8.2. Test your knowledge

14.8.3. Try it out

15. Modules

15.1. What’s a module?

15.2. Why use modules?

15.2.1. Buckets of blocks

15.3. How do we create modules?

15.4. How do we use modules?

15.5. Namespaces

15.5.1. What’s a namespace?

15.5.2. Importing namespaces

15.5.3. Importing using from

15.5.4. Whew!

15.6. Standard modules

15.6.1. Time

15.6.2. Random numbers

15.6.3. What did you learn?

15.6.4. Test your knowledge

15.6.5. Try it out

16. Graphics

16.1. Getting some help: Pygame

16.2. A Pygame window

16.3. Drawing in the window

16.3.1. What’s the “flip”?

16.3.2. How to make a circle

16.3.3. Pygame surfaces

16.3.4. Colors in Pygame

16.3.5. Locations: Screen coordinates

16.3.6. Size of shapes

16.3.7. Line width

16.3.8. Modern art?

16.4. Individual pixels

16.4.1. Connect the dots

16.4.2. Connect the dots, again

16.4.3. Drawing point-by-point

16.5. Images

16.6. Let’s get moving!

16.7. Animation

16.7.1. Erasing images

16.7.2. What’s under there?

16.8. Smoother animation

16.8.1. Keeping the ball moving

16.9. Bouncing the ball

16.9.1. Bouncing in 2-D

16.10. Wrapping the ball

16.10.1. What did you learn?

16.10.2. Test your knowledge

16.10.3. Try it out

17. Sprites and Collision Detection

17.1. Sprites

17.1.1. A sprite class

17.1.2. A move() method

17.2. Bump! Collision detection

17.2.1. Rect collision vs. pixel-perfect collision

17.3. Counting time

17.3.1. Controlling the frame rate with pygame.time.Clock()

17.3.2. Checking the frame rate

17.3.3. Scaling the frame rate

17.3.4. What did you learn?

17.3.5. Test your knowledge

17.3.6. Try it out

18. A New Kind of Input: Events

18.1. Events

18.1.1. The event loop

18.1.2. The event queue

18.1.3. Event handlers

18.2. Keyboard events

18.2.1. Key events

18.2.2. Repeating keys

18.2.3. Event names and key names

18.3. Mouse events

18.4. Timer events

18.5. Time for another game—​PyPong

18.5.1. The ball

18.5.2. The paddle

18.5.3. Controlling the paddle

18.5.4. Keeping score and displaying it with pygame.font

18.5.5. Keeping track of lives

18.5.6. Adding a life counter

18.5.7. Game over

18.5.8. What did you learn?

18.5.9. Test your knowledge

18.5.10. Try it out

19. Sound

19.1. More help from Pygame: mixer

19.2. Making sounds vs. playing sounds

19.3. Playing sounds

19.3.1. Using pygame.mixer

19.4. Controlling volume

19.5. Playing background music

19.6. Repeating music

19.7. Adding sounds to PyPong

19.7.1. More wacky sounds

19.8. Adding music to PyPong

19.8.1. What did you learn?

19.8.2. Test your knowledge

19.8.3. Try it out

20. More GUIs

20.1. Working with PyQt

20.2. Qt Designer

20.2.1. Adding a button

20.2.2. Changing the button

20.3. Saving the GUI

20.3.1. Making our GUI do something

20.4. The return of event handlers

20.4.1. What is self?

20.4.2. Moving the button

20.5. More useful GUIs

20.6. TempGUI

20.6.1. TempGUI components

20.7. Creating the new GUI

20.7.1. Converting Celsius to Fahrenheit

20.7.2. Converting Fahrenheit to Celsius

20.7.3. A small improvement

20.8. Squashing a bug

20.9. What’s on the menu?

20.9.1. Adding a menu item

20.9.2. Hotkeys

20.9.3. What did you learn?

20.9.4. Test your knowledge

20.9.5. Try it out

21. Print Formatting and Strings

21.1. New lines

21.1.1. print and end=''

21.1.2. Adding our own newlines

21.1.3. Special printing codes

21.2. Horizontal spacing: Tabs

21.2.1. How do we print a backslash?

21.3. Inserting variables in strings

21.4. Number formatting

21.4.1. Integers: %d or %i

21.4.2. Floating point numbers: %f or %F

21.4.3. E-notation: %e and %E

21.4.4. Automatic float or E-notation: %g and %G

21.4.5. How do we print a percent sign?

21.4.6. More than one format string

21.4.7. Storing formatted numbers

21.5. Formatting, the new way

21.5.1. F-strings

21.6. Strings ‘n’ things

21.6.1. Splitting strings

21.6.2. Joining strings

21.6.3. Searching for strings

21.6.4. Searching anywhere in a string: in and index()

21.6.5. Removing part of a string

21.6.6. Changing case

21.6.7. What did you learn?

21.6.8. Test your knowledge

21.6.9. Try it out

22. File Input and Output

22.1. What’s a file?

22.2. Filenames

22.3. File locations

22.3.1. Finding where you are

22.3.2. Enough about paths!

22.4. Opening a file

22.5. Reading a file

22.5.1. Reading one line at a time

22.5.2. Going back to the start

22.6. Text files and binary files

22.7. Writing to a file

22.7.1. Appending to a file

22.7.2. Writing to a file using write mode

22.7.3. Writing to a file using print()

22.8. Saving your stuff in files: pickle

22.8.1. Pickling

22.8.2. Unpickling

22.9. Game time again—​Hangman

22.9.1. The Hangman GUI

22.9.2. Getting words from the word list

22.9.3. Revealing the man

22.9.4. Checking the letter guesses

22.9.5. What did you learn?

22.9.6. Test your knowledge

22.9.7. Try it out

23. Take a Chance: Randomness

23.1. What’s randomness?

23.2. Rolling the dice

23.2.1. More than one die

23.2.2. Ten in a row

23.3. Creating a deck of cards

23.3.1. Shuffling the deck

23.3.2. A card object

23.4. Crazy Eights

23.4.1. The main loop

23.4.2. The up card

23.4.3. The active suit

23.4.4. The player’s turn

23.4.5. Displaying the hand

23.4.6. Getting the player’s choice

23.4.7. The computer’s turn

23.4.8. Keeping score

23.4.9. What did you learn?

23.4.10. Test your knowledge

23.4.11. Try it out

24. Computer Simulations

24.1. Modeling the real world

24.2. Lunar Lander

24.2.1. Simulating the landing

24.2.2. Pygame returns

24.3. Keeping time

24.4. Time objects

24.4.1. Difference between two times

24.4.2. Small pieces of time

24.4.3. Saving time to a file

24.5. Virtual Pet

24.5.1. The GUI

24.5.2. The algorithm

24.5.3. Simple animation

24.5.4. Try, try again

24.5.5. What did you learn?

24.5.6. Test your knowledge

24.5.7. Try it out

25. Skier Explained

25.1. The skier

25.2. The obstacles

25.2.1. Creating individual obstacles

25.2.2. Creating a map of obstacles

25.2.3. What did you learn?

25.2.4. Try it out

26. Making Network Connections with Sockets

26.1. What’s the difference between text and bytes?

26.2. Servers

26.3. Getting data from the client

26.4. Making a chat server

26.4.1. A little about IP addresses

26.4.2. Creating a chat client

26.4.3. What did you learn?

26.4.4. Test your Knowledge

26.4.5. Try it out

27. What’s Next?

27.1. For younger programmers

27.2. Python

27.3. Game programming and Pygame

27.4. Other game programming (non-Python)

27.5. Keep it BASIC

27.6. Websites

27.7. Mobile apps

27.8. Look around

Appendixes

Appendix A: Variable Naming Rules

Appendix B: Differences Between Python 3 and 2

B.1. print

B.2. input()

B.3. Integer division

B.4. range()

B.5. Bytes and character encodings

B.6. Python 2 to 3 conversion

Appendix C: Answers to Self-Test Questions

C.1. Chapter 1: Getting Started

C.1.1. Test your knowledge

C.1.2. Try it out

C.2. Chapter 2: Remember This: Memory and Variables

C.2.1. Test your knowledge

C.2.2. Try it out

C.3. Chapter 3: Basic Math

C.3.1. Test your knowledge

C.3.2. Try it out

C.4. Chapter 4: Types of Data

C.4.1. Test your knowledge

C.4.2. Try it out

C.5. Chapter 5: Input

C.5.1. Test your knowledge

C.5.2. Try It Out

C.6. Chapter 6: GUIs: Graphical User Interfaces

C.6.1. Test your knowledge

C.6.2. Try it out

C.7. Chapter 7: Decisions, Decisions

C.7.1. Test your knowledge

C.7.2. Try it out

C.8. Chapter 8: Loop the Loop

C.8.1. Test your knowledge

C.8.2. Try it out

C.9. Chapter 9: Just for You—​Comments

C.9.1. Try it out

C.10. Chapter 10: Game Time

C.10.1. Try it out

C.11. Chapter 11: Nested and Variable Loops

C.11.1. Test your knowledge

C.11.2. Try it out

C.12. Chapter 12: Collecting Things Together—​Lists and Dictionaries

C.12.1. Test your knowledge

C.12.2. Try it out

C.13. Chapter 13: Functions

C.13.1. Test your knowledge

C.13.2. Try it out

C.14. Chapter 14: Objects

C.14.1. Test your knowledge

C.14.2. Try it out

C.15. Chapter 15: Modules

C.15.1. Test your knowledge

C.15.2. Try it out

C.16. Chapter 16: Graphics

C.16.1. Test your knowledge

C.16.2. Try it out

C.17. Chapter 17: Sprites and Collision Detection

C.17.1. Test your knowledge

C.18. Chapter 18: A New Kind of Input: Events

C.18.1. Test your knowledge

C.18.2. Try it out

C.19. Chapter 19: Sound

C.19.1. Test your knowledge

C.19.2. Try it out

C.20. Chapter 20: More GUIs

C.20.1. Test your knowledge

C.20.2. Try it out

C.21. Chapter 21: Print Formatting and Strings

C.21.1. Test your knowledge

C.21.2. Try it out

C.22. Chapter 22: File Input and Output

C.22.1. Test your knowledge

C.22.2. Try it out

C.23. Chapter 23: Take a Chance—​Randomness

C.23.1. Test your knowledge

C.23.2. Try it out

C.24. Chapter 24: Computer Simulations

C.25. Test your knowledge

C.26. Try it out

C.27. Chapter 26: Making Network Connections with Sockets

C.28. Test your knowledge

C.29. Try it out

What's inside

  • Colorful pictures, clever cartoons, and fun examples
  • Practice questions and exercises
  • Updated to Python 3

About the reader

You don’t need to know anything about programming to use the book. If you can open an app and save a file, you’re ready to go!

About the authors

Warren Sande is an electronic systems engineer who uses Python as his favorite “do anything” scripting language at work, and also uses it to help teach people about computers and programming. Carter Sande started programming when he was six years old, wrote the first edition of this book with his dad when he was nine, and now works as a professional software engineer. In his spare time, he creates games for retro consoles like the Game Boy Advance and enjoys reading and writing interactive fiction.

Illustrated by Martin Murtonen.


placing your order...

Don't refresh or navigate away from the page.
print book $29.99 $39.99 pBook + eBook + liveBook
includes previous edition eBook
Additional shipping charges may apply
Hello World! Third Edition (print book) added to cart
continue shopping
go to cart

eBook $24.99 $31.99 3 formats + liveBook
includes previous edition eBook
Hello World! Third Edition (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks