For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact:
Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email:
2014 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Praise for the First Edition of Hello! World
A great book for little kids and big kids alike.
Gordon Colquhoun, Computer Consultant, Avalon Consulting Services
Python for growing-ups.
Dr. John Grayson, Author of Python and Tkinter Programming
A fun book to read and learn from!
Dr. Andr Roberge, President, Universit Sainte-Anne
The authors have created a friendly educational programming book that makes learning fun and painless.
Bryan Weingarten, Software Architect
I highly recommend this book!
Horst Jens, Python Instructor and Author of Programming While Playing
Python is a wonderful language for teaching beginners to program. It is great to see a kid-focused Python book!
Jeffrey Elkner, Educator
If you teach your child one thing, teach her the golden rule. If you teach her two things, then teach her the golden rule and computer programming. This book is all you need for the latter.
Josh Cronemeyer, Senior Software Consultant, Thoughtworks
I enjoyed the interaction with Carter in the book ... My students are really going to enjoy the Digital Pet program! Reminds me of the Tamagotchi Virtual Pet that I had years ago.
Kari J Stellpflug, Educator, Rochester Public Schools, Rochester MN
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
Advance Praise for the Second Edition of Hello! World
It made programming seem as easy as frying bacon.
Elisabet Gordon, 10th-grade student, Eagle Harbor High School
A great intro to the world of Python for everyone. This book is so much fun!
Mason Jenkins, 7th-grade student, Myron B. Thompson Academy
For kids from 8 to 88. The book not only covers programming in Python in a fun way, but also sets the groundwork for good practices that can be used for other programming languages as well.
Ben Ooms, Software Engineer, Sogeti
If you want to learn programming or teach it to a kid, this is your book.
Cuberick.com
A very good introduction to programming for anyone, young or old, who wants to start learning this vital and highly enjoyable skill.
Sue Gee, I-Programmer
Warren and Carter start simply, at the beginning, and take kids or adults all the way to making fun 2D graphical games and simulations. Python is my first choice for a real programming language for new programmers, and using this book is a great way to learn it. Ive been recommending this book to my students since the First Edition came out.
Dave Briccetti, Software Developer and Teacher, Dave Briccetti Software LLC
Preface
The preface is that part at the beginning of a book that you skip over to get to the good stuff, right? Sure, you can skip over it if you want (hey, youre the one turning the pages), but who knows what you might miss.... Its not very long, so maybe you should give it a look, just in case.
What is programming?
Very simply, programming means telling a computer to do something. Computers are dumb machines. They dont know how to do anything. You have to tell them everything, and you have to get all the details right.
But if you give them the right instructions, they can do many wonderful and amazing things.
Word BoxAn instruction is a basic command you give to a computer, usually to do a single, very specific thing.
A computer program is made up of a number of instructions. Computers do all the great things they do today because a lot of smart programmers wrote programs or software to tell them how. Software just means a program or collection of programs that run on your computer, or sometimes on another computer yours is connected to, like a web server.
Whats Going on in There?Computers think using lots and lots and LOTS of electrical circuits. At the most basic level, these circuits are switches that are either ON or OFF.
Engineers and computer scientists use 1 and 0 to stand for ON and OFF. All these 1s and 0s are a kind of code called binary. Binary really just means two states. The two states are ON and OFF, or 1 and 0.
Did you know: binary digit = bit.
Pythona language for us and the computer
All computers use binary inside. But most people dont speak binary very well. We need an easier way to tell the computer what we want it to do. So people invented programming languages. A computer programming language lets us write things in a way we can understand, and then translates that into binary for the computer to use.
There are many different programming languages. This book will teach you how to use one of those languagesone called Pythonto tell the computer what to do.