1.1. About This Section of the Book¶
This text is intended for students who haven’t programmed before and for students who may not be intending on a career in software development. It uses the programming language Python, which is considered one of the easier programming languages to learn, but is powerful enough to be used by companies like Google and Pixar.
Learning to write code is a little like learning to write English. You can’t hope to sit down and write something if you do not understand the language. You have to start by learning to read the language. In reading, you learn not just how the language works, but how skilled writers use language to communicate. However, progressing from reader to writer requires additional work. It is one thing to read a well crafted essay, another thing entirely to write one. The same is true of programming. You need to learn how to read and understand code to be able to write it. But then, you need to practice writing code to learn the art of building new programs.
Thus, this text uses the following sequence to introduce programming as a whole and individual topics:
Rather than having you write lots of code right away, we will ask you to read a lot of code examples.
We ask you to use what you are learning from the examples in some simple practice exercises. These exercises are meant to be short and easy.
Eventually you will build to writing your own interesting programs.
This first chapter introduces the approach used in this book and offers some quick “teasers” of things we’ll be doing later. Don’t worry if you don’t understand the code (programs - instructions that a computer can understand) that you see in this chapter. We’ll go through things much more slowly in the next few chapters.
The programming portion of this text is based on the book StudentCSP and is used under the following license:
Mark Guzdial and Barbara Ericson email@example.com January, 2014
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Mark Guzdial and Barbara Ericson BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.