Copyright 2019 by Rockridge Press, Emeryville, California
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, Rockridge Press, 6005 Shellmound Street, Suite 175, Emeryville, CA 94608.
Limit of Liability/Disclaimer of Warranty: The Publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the Publisher is not engaged in rendering medical, legal, or other professional advice or services. If professional assistance is required, the services of a competent professional person should be sought. Neither the Publisher nor the author shall be liable for damages arising herefrom. The fact that an individual, organization, or website is referred to in this work as a citation and/or potential source of further information does not mean that the author or the Publisher endorses the information the individual, organization, or website may provide or recommendations they/it may make. Further, readers should be aware that Internet websites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the United States at (866) 744-2665, or outside the United States at (510) 253-0500.
Rockridge Press publishes its books in a variety of electronic and print formats. Some content that appears in print may not be available in electronic books, and vice versa.
TRADEMARKS: Rockridge Press and the Rockridge Press logo are trademarks or registered trademarks of Callisto Media Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. Rockridge Press is not associated with any product or vendor mentioned in this book.
python.org images used with permission from the Python Software Foundation.
Interior and Designer: Merideth Harte
Photo Art Director: Sue Bischofberger
Editor: Susan Randol
Production Editor: Andrew Yackira
Illustrations: Amir Abou Roumi
ISBN: Print 978-1-64152-175-8 | eBook 978-1-64152-176-5
R1
To the technologists of tomorrow
Coding for Kids: Python is a unique and fun introduction to the Python programming language. Written for someone with absolutely no experience with coding, this book uses silly analogies, helpful examples, and many activities and games to help anyone learn how to code in Python!
Let me share a little about myself, your excited author: I am currently a full-time software engineer who finds joy and fulfillment in helping new and potential coders of all kinds. Ive spent many hours volunteering at local elementary and high schools, speaking to students about careers in software development, and teaching the basics of coding. It is so fun to see the spark in someones eye when they see the power of code. I wrote this book to spark the imagination and wonder of many more people!
Code is at the core of almost everything we use and love. We can write code to make games, create music and art, bring robots to life, and power almost anything that is electronic. When you realize how much coding is a part of the world of the future, it becomes so important to learn how it works! This book will help you do just that.
Coding is literally translating human ideas and actions into a language that computers can understand. Python is one of the languages, but there are many othersfor example: JavaScript, C#, Ruby, and C++. Each of these languages tells the computer how to do something, but each one does it a bit differently. I chose Python for this book because it is very close to our speaking language of English, which makes the coding concepts I will introduce a little easier to understand. :)
The best part about coding is that you just need a computer and this book! From the first chapter to the last, Ill guide you through the coding concepts you need to know, with step-by-step instructions and examples, plenty of helpful screenshots, and simple explanations of the new programming terms youll learn (all of which are also available for you in the handy at the back of the book!). By the time youve finished this book, youll be creating some really cool programs and even simple games that you can play with friends! Hangman, anyone?
Coding is one skill that youll only learn by doing. Thats why Ive structured each chapter to walk you through the code as you follow along. This makes the book truly interactive, as youll learn about a concept, write some code, understand what its doing, read and learn a bit more, maybe fix a bug or two, and see the results of your code in real time! And to really help you understand the different coding concepts in this book, Ive also included activities at the end of each chapter to help you test your knowledge, combine multiple concepts, and write more code. After all, practice makes perfectespecially with coding! Finally, if some of the activities are too easy for you, or if you just want to keep coding, Ive included even more difficult challenges after each chapter to really stretch your brain and give you more chances to show off your creativity!
This book will help you start an incredible adventure into the world of programming. By the end of it, youll be ready for the world of the future! What are you waiting for?
Hey there! Since youre reading this book, you must be a pretty curious and cool person. Why? Because you want to learn how to code! And who wouldnt? Coding is an awesome skill that can help you build all kinds of things and solve a lot of problems. When you code, you take human ideas and then translate them into a language that a machine can understand.
Coding is built around the concept of input and output. We give the computer some input , which is any information or data provided by us humans, and expect some output , which can be words, pictures, an action, or some other result, after the computer has processed the input we gave it. Sounds interesting, doesnt it?