Preview

Thinkcspy CEP Textbook

Best Essays
Open Document
Open Document
131187 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Thinkcspy CEP Textbook
How to Think Like a Computer
Scientist: Learning with Python 3
Documentation
Release 3rd Edition

Peter Wentworth, Jeffrey Elkner,
Allen B. Downey and Chris Meyers

August 12, 2012

CONTENTS

1

2

3

The way of the program
1.1 The Python programming language
1.2 What is a program? . . . . . . . . .
1.3 What is debugging? . . . . . . . .
1.4 Syntax errors . . . . . . . . . . . .
1.5 Runtime errors . . . . . . . . . . .
1.6 Semantic errors . . . . . . . . . . .
1.7 Experimental debugging . . . . . .
1.8 Formal and natural languages . . .
1.9 The first program . . . . . . . . . .
1.10 Comments . . . . . . . . . . . . .
1.11 Glossary . . . . . . . . . . . . . .
1.12 Exercises . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

1
1
3
3
3
4
4
4
5
6
7
7
9

Variables, expressions and statements
2.1 Values and data types . . . . . . .
2.2 Variables . . . . . . . . . . . . .
2.3 Variable names and keywords . .
2.4 Statements . . . . . . . . . . . .
2.5 Evaluating expressions . . . . . .
2.6 Operators and operands . . . . .
2.7 Type converter functions . . . . .
2.8 Order of operations . . . . . . . .
2.9 Operations on strings . . . . . . .
2.10 Input . . . . . . . . . . . . . . .
2.11 Composition . . . . . . . . . . .
2.12 The modulus operator . . . . . .
2.13 Glossary . . . . . . . . . . . . .
2.14 Exercises . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.

You May Also Find These Documents Helpful