Learn toProgram withPython 3 A Step-by-Step Guide to Programming Second Edition Irv Kalb Learn to Programwith Python 3A Step-by-Step Guideto ProgrammingSecond EditionIrv KalbLearn to Program with Python 3 Irv Kalb Mountain View, California, USA ISBN-13 (pbk): 978-1-4842-3878-3 ISBN-13 (electronic): 978-1-4842-3879-0 https://doi.org/10.1007/978-1-4842-3879-0 Library of Congress Control Number: 2018954633 Copyright 2018 by Irv Kalb This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made.
The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Todd Green Development Editor: James Markham Coordinating Editor: Jill Balzano Cover designed by eStudioCalamar Cover image designed by Freepik (www.freepik.com) Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail rights@apress.com, or visit www.apress.com/ rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book's product page, located at www.apress.com/9781484238783. For more detailed information, please visit www.apress.com/source-code. Printed on acid-free paper This book is dedicated to the memory of my mother, Lorraine Kalb.I started learning about programming when I was 16 years old,at Columbia High School in Maplewood, New Jersey.We were extremely fortunate to have a very early computer,an IBM 1130, that students could use.I remember learning the basics of the Fortran programming languageand writing a simple program that would add two numbers togetherand print the result.
I was thrilled when I finally got my program towork correctly. It was a rewarding feeling to be able to get this huge,complicated machine to do exactly what I wanted it to do.I clearly remember explaining to my mother that I wrote thisprogram that got the computer to add 9 and 5 and come up with ananswer of 14. She said that she didnt need a computer to do that.I tried to explain to her that getting the answer of 14 was not theimportant part. What was important was that I had written aprogram that would add any two numbers and print the result. Shestill didnt get it, but she was happy for me and very supportive.Hopefully, through my explanations in this book, you will get it.Table of Contents v Table of ConTenTs vi Table of ConTenTs vii Table of ConTenTs viii Table of ConTenTs ix Table of ConTenTs x Table of ConTenTs xi Table of ConTenTs xii About the AuthorIrv Kalb is an adjunct professor at UCSC (University of California, Santa Cruz) Extension Silicon Valley and Cogswell Polytechnical College. He has been teaching software development classes since 2010.
Irv has worked as a software developer, manager of software developers, and manager of software development projects. He has been an independent consultant for many years with his own company, Furry Pants Productions, where he has concentrated on educational software. Prior to that, he worked as an employee for a number of high-tech companies. He has BS and MS degrees in computer science. Recently, he has been a mentor to a number of local competitive robotics teams. His previous publications include numerous technical articles, two childrens edutainment CD-ROMs (about Darby the Dalmatian), an online e-book on object- oriented programming in the Lingo programming language, and the first book on Ultimate Frisbee, Ultimate: Fundamentals of the Sport (Revolutionary Publications, 1983).
He was highly involved in the early development of the sport of Ultimate Frisbee. xiii About the Technical ReviewerMark Furman, MBA is a systems engineer, author, teacher, and entrepreneur. For the last 16 years he has worked in the information technology field with a focus on Linux-based systems and programming in Python. Hes worked for a range of companies including Host Gator, Interland, Suntrust Bank, AT&T, and Winn-Dixie. Currently he has been focusing his career on the maker movement and has launched Tech Forge (techforge.org), which focuses on helping people start a makerspace and help sustain current spaces. He holds an MBA degree from Ohio University.
You can follow him on Twitter @mfurman. xv Acknowledgments I would like to thank the following people, without whom this book would not have been possible: My wonderful wife, Doreen, who is the glue that keeps our family together. Our two sons, Jamie and Robbie, who keep us on our toes. Our two cats, Chester and Cody (whom we think of as people). Mariah Armstrong, who created all the graphics in this book. I am not an artist (I dont even play one on TV).
Mariah was able to take my chicken scratches and turn them into very clear and understandable pieces of art. Chris Sasso and Ravi Chityala for their technical reviews and helpful suggestions. Luke Kwan, Catherine Chanse, and Christina Ri at the Art Institute of California-Silicon Valley. Andy Hou at the UCSC-Silicon Valley Extension. Jerome Solomon at Cogswell Polytechnical College, who first suggested that I consider getting into Python. Jill Balzano, Jim Markham, Mark Furman, and Todd Green at Apress for all the work they did reviewing, editing, and expertly answering all my questions.
All the students who have been in my classes over many years at the Art Institute California-Silicon Valley, Cogswell Polytechnical College, and the UCSC Silicon Valley Extension. Their feedback, suggestions, smiles, frowns, light-bulb moments, frustrations, and knowing head-nods were extremely helpful in shaping the content of this book. Finally, Guido van Rossum, without whom Python would not exist. xvii
Next page