Mark Redd

1 - Introduction and How to Use this Book

Python changed my life. Before learning Python, computers intimidated me. Python opened up to me a world of programming that made computers into useful tools instead of necessary evils. Regardless of the reason you are reading this book right now, I hope that Python will have a similar impact on you.

I am writing this book to introduce Python to newcomers to programming. If you are an experienced programmer and are looking to add Python to your repertoire, this may not be the book for you. The intent of this book is, primarily, to give a solid introduction to Python, and some introductory computer science, to those who are completely new to programming.

To that end, I have the following goals in mind while writing this book:

How to use this book

In this book, I aim to get you coding ASAP and constantly encourage you to try things yourself. You will learn a lot more actually attempting to write code than you will reading about it. With that said, there are some things you should know before beginning.

You MUST do some boring stuff BEFORE you can do interesting stuff

In the 1984 film “The Karate Kid”, Mr. Miyagi, the teacher, doesn’t start training Daniel in Karate by teaching him fancy moves but instead begins by having him perform many menial tasks with no apparent point to them. It is in doing these seemingly pointless tasks that Daniel first begins to have skill in Karate.

Anytime you learn a new skill you must do many boring and seemingly pointless things before you can do something interesting or useful. Every discipline has this feature. I am telling you this because for me, a person with a very limited attention span, the beginning of learning programming was agonizingly slow and seemingly pointless. You may feel that way too.

However, if you will do the following simple things in every section you will be well on your way:

  1. Read the section
  2. Write the code from each section code EXACTLY as it is written without copy-pasting it
  3. Make it run
  4. Understand what the code you wrote does

When things get boring or tedious, remember the Karate Kid. You are building a foundation on which you can move mountains. In addition, each section can include some features that will enhance your ability.

What is in each section?

In each section of this book, reading and exercises will be ordered by how mandatory they are. If you wish to move as quickly as possible, you may only do the first part of each section where I will cover the essential material. However, I do recommend doing everything under “Hone Your Skills” in every section to get the most out of this book.

The sections generally will be divided in to 3 subsections. Each of these sections has a distinct purpose. Depending on your level of skill and interest there are a number of ways of approaching each section. They are as follows:

This book is intended to serve you and not the other way around. Therefore, I recommend you do the reading and basic exercises of each section. Beyond that, you are free to pursue what interests you and skip anything that doesn’t. There are multiple ways to approach learning but one way is to do the “Reading and basic exercises” from each section first and then add to your knowledge with the other two subsections.

Defining Terms

We will introduce several terms throughout this book with which you may be unfamiliar. Where this is the case, you may view a definition of the word or phrase by hovering your mouse cursor over the word or phrase in bold (e.g. here is the definition of Python)

Learning to feed yourself

I will sometimes have you read The Official Python Documentation, visit other websites or resources, or have you use an internet search engine to learn about a particular topic. I do this for a number of reasons but most importantly, I want you to be able to teach yourself everything this book cannot. It would be my goal that, after you have read and learned everything in this book, you can put it down and never pick it up again because you have learned how to find answers to your own questions. Doing this will make you that much more effective as a programmer and more effective as a human being in general.

Remember: Whenever I tell you to search for something on the Internet, remember that the best way to use a search engine is to type “Python” and then write what you are looking for. This will be a boon to your learning as you go along.