Introduction to Python 2018 Edition
Mark Lassoff and Julius Hernandez
Published by LearnToProgram.tv, LLC, 2018.
While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
INTRODUCTION TO PYTHON 2018 EDITION
First edition. April 16, 2018.
Copyright 2018 Mark Lassoff and Julius Hernandez.
Written by Mark Lassoff and Julius Hernandez.
10 9 8 7 6 5 4 3 2 1
For my family, friends and colleagues who supported the development of LearnToProgram.tv and this book.
and
To my niece who is the best ten-year-old programmer I know!
INTRODUCTION TO PYTHON
2018 EDITION
By
Mark Lassoff
with Julius Hernandez
LearnToProgram, LLC
129 Church Street #230
New Haven, CT 06510
LearnToProgram.tv, Incorporated
129 Church Street #230
New Haven, CT 06510
contact@learntoprogram.tv
(860) 840-7090
ISBN: 9781980820574
2018 by LearnToProgram.tv, Incorporated
All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without prior written permission of LearnToProgram.tv, Incorporated.
Limit of Liability/Disclaimer of Warranty : While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation. You should consult with a professional where appropriate. By following the instructions contained herein, the reader willingly assumes all risks in connection with such instructions. Neither the publisher nor author shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, exemplary, or other damages resulting in whole or part, from the readers use of, or reliance upon, this material.
Dedication
For my family, friends and colleagues who supported
the development of LearnToProgram.tv and this book.
and
To my niece who is the best ten-year-old programmer I know!
Table of Contents
F igure 1.1. The familiar Python logo. Python is a well-supported, open-sourced language. It is freely-available for both personal and commercial use.
Welcome to Python for Beginners! With this book, you will learn the basics of Python, a powerful high-level and object-oriented programming language that is suitable for both beginners and experienced programmers. The goal of Python is to make programming easy to learn. It is open-source and is free to use and distribute, even commercially.
P rior knowledge of Python is not required to learn from this book. Whether you are new to programming or you are someone who has programmed before using another language, you will find this book to be the ideal resource for learning Python.
For beginners who are new to Python, computer science knowledge would be helpful. However, it is not required. It is important to spend time understanding the concepts and doing the coding exercises. This is a sure-fire way to retain knowledge gained from this book.
The concepts discussed in the book will be familiar to someone with prior programming experience. For those readers, it is expected that the book will fast-track their understanding of Python programming concepts and how they differ from the language/s they have used before.
At the end of the course, you will have the basic skills necessary to take your Python programming skills to the next level. Learn to Programs Python for Game Development courses are perfect for that.
Figure 1.2. Learning the basics of Python programming has never been easier with the Python for Beginners video course on Learn to Program TV and this companion book. After you have completed this beginners course, you can take your Python development skills to the next level with our Game Development for Python courses.
What Does the Book Cover?
T his book has 12 chapters , including this introductory chapter. We will go through the next chapters briefly below.
Figure 1.3. The home page of the Python.org website, where you can download installers and documentation on the Python programming language. The website also features the latest news and events about Python, and the robust Python user community.
In Chapter 2, you will start by downloading and installing Python (installation packages are available for Windows, Linux and other Unix-based platforms, and Mac OS X). You will then code your first Python program using IDLE , or the Integrated Development and Learning Environment , which is installed with Python. Your very first Python program would be a simple program. However, what better way is there to fire up the excitement of learning a programming language than writing your first program? You will then execute the program from the command line. In this chapter, you will also learn how to use the Python shell window interactively. You will be able to write and run programming commands directly from the shell window. You will then have a coding exercise at the end, that will reinforce the concepts discussed in the chapter.