Think like a computer scientist Python (2nd edition) pdf

Source: Internet
Author: User
Tags arithmetic operators logical operators mathematical functions square root

: Network Disk Download

Content Introduction· · · · · ·

This book is intended to foster the reader's understanding of Python programming in the same way that computer scientists think. The main body of the whole book is how to think, design, develop the method, and the specific programming language, but provides a specific scenario to facilitate the introduction of the medium.

There are 21 chapters in this book detailing all aspects of Python language programming. This book begins with basic programming concepts, including language syntax and semantics, and each programming concept has a clear definition that leads the reader to progressively learn variables, expressions, statements, functions, and data structures. It also explores how to work with files and databases, how to understand objects, methods, and object-oriented programming, and how to use debugging techniques to correct syntax errors, run-time errors, and semantic errors. Each chapter is equipped with a glossary and exercises to facilitate the reader to consolidate the knowledge and skills learned. In addition, each chapter draws a section to explain how to debug a program. The author summarizes all aspects of debugging, focusing on the language features of each chapter, or related development issues.

The 2nd and 1th editions of the book have made a lot of updates, upgrading the programming language from Python 2 to Python 3, and modifying a lot of examples and exercises, adding new chapters and a more comprehensive introduction to the Python language.

This is a practical learning guide for programmers who don't have Python programming experience, and for high school or university students, Python enthusiasts, and people who need to understand the basics of programming. It is a rare masterpiece for the first-time contact program.

Author profile ...

[US] Alan B. Downey (Allen B. Downey)

Allen Downey is a professor of computer science at the Orin School of Engineering and has taught at Wellesley College, Colby College and University of California at Berkeley. He is a PhD in computer science from the University of California, Berkeley, and holds a master's and bachelor's degree from MIT.

Translator Introduction

Zhao Puming graduated from Tsinghua University Computer department, engaged in software development industry for nearly 10 years. Starting with the 2.3 version, Python was used to write scripts for rapid prototyping and log calculations, and for everyday tasks such as a programming language enthusiast, for D, Kotlin, Lua, Clojure, Scala, Julia, Go and other languages are known, but today is still the unique style of Python, simple design and marvel.

Table of Contents, chapter 1th procedure 1
1.1 What is a program 1
1.2 Running Python 2
1.3 First Program 3
1.4 Arithmetic Operators 3
1.5 Value and Type 4
1.6 Formal language and natural language 5
1.7 Commissioning 6
1.8 Glossary 7
1.9 Exercise 8
Chapter 2nd variables, expressions, and statements 9
2.1 Assignment Statement 9
2.2 Variable name 9
2.3 Expressions and Statements 10
2.4 Script Mode 11
2.5 Sequence of Operations 12
2.6 String Manipulation 13
2.7 Notes 13
2.8 Commissioning 14
2.9 Glossary 15
2.10 Exercise 16
3rd Chapter Function 17
3.1 Function Call 17
3.2 Mathematical Functions 18
3.3 Combination 19
3.4 Adding a new function 19
3.5 Definition and use 21
3.6 Implementation Process 21
3.7 Formal parameters and arguments 22
3.8 variables and formal parameters are local 23
3.9 Stack Diagram 23
3.10 There is a return value function and no return value function 24
3.11 Why should I have a function 25
3.12 Commissioning 26
3.13 Glossary 26
3.14 Exercise 27
4th Case Study: interface design 30
4.1 Turtle Module 30
4.2 Simple Repetition 31
4.3 Exercise 32
4.4 Package 33
4.5 Generalization 34
4.6 Interface Design 34
4.7 Refactoring 35
4.8 A development Plan 36
4.9 Document String 37
4.10 Commissioning 38
4.11 Glossary 38
4.12 Exercise 39
Chapter 5th conditions and recursion 41
5.1 Divide-by-division operator and modulo operator 41
5.2 Boolean Expression 42
5.3 Logical Operators 42
5.4 Item Execution 43
5.5 Select Execution 43
5.6-Piece Chain 44
5.7 Nesting conditions 44
5.8 Recursion 45
5.9 stack diagram of recursive functions 46
5.10 Infinite Recursion 47
5.11 Keyboard Input 47
5.12 Commissioning 48
5.13 Glossary 49
5.14 Exercise 50
The 6th chapter has a function of return value 53
6.1 Return value 53
6.2 Incremental Development 54
6.3 Combination 56
6.4 Boolean function 57
6.5 Talk about recursion 58
6.6 Adherence to Faith 59
6.7 Another example 60
6.8 Check Type 60
6.9 Commissioning 61
6.10 Glossary 63
6.11 Exercise 63
Chapter 7th Iteration 65
7.1 Re-assigned value 65
7.2 Updating Variables 66
7.3 While Statement 66
7.4 Break Statement 68
7.5 Square Root 68
7.6 Algorithm 70
7.7 Commissioning 70
7.8 Glossary 71
7.9 Exercise 71
8th Chapter String 73
8.1 string is a sequence 73
8.2 Len 74
8.3 Traversing with a for loop 74
8.4 String Slicing 75
8.5 The string is immutable 76
8.6 Search 77
8.7 Cycles and Counting 77
8.8 String Method 78
8.9 operator in 79
8.10 string Comparison 79
8.11 Commissioning 80
8.12 Glossary 82
8.13 Exercise 82
The 9th Chapter Case Analysis: Word game 85
9.1 Reading the word list 85
9.2 Exercise 86
9.3 Search 87
9.4 Using subscript loop 88
9.5 Commissioning 90
9.6 Glossary 90
9.7 Exercise 91
The 10th Chapter List 93
10.1 list is a sequence of 93
10.2 List is Variable 94
10.3 Traversing a list 95
10.4 List Operations 95
10.5 List Slices 96
10.6 List Method 96
10.7 mapping, filtering, and simplifying 97
10.8 Deleting an element 98
10.9 List and string 99
10.10 Objects and Values 100
10.11 Aliases 101
10.12 List Parameters 102
10.13 Commissioning 103
10.14 Glossary 104
10.15 Exercise 105
11th Chapter Dictionary 108
11.1 Dictionary is a mapping 108
11.2 Using a dictionary as a counter set 110
11.3 Loops and Dictionaries 111
11.4 Reverse Lookup 111
11.5 Dictionaries and Lists 112
11.6 Memo 114
11.7 Global Variables 115
11.8 Commissioning 117
11.9 Glossary 118
11.10 Exercise 119
12th Chapter Tuple 121
12.1 Tuples are immutable 121
12.2 Tuple Assignment 122
12.3 Tuple as the return value 123
12.4 variable-length parameter tuple 124
12.5 Lists and tuples 124
12.6 Dictionaries and tuples 126
Sequence of 12.7 sequences 127
12.8 Commissioning 128
12.9 Glossary 129
12.10 Exercise 129
13th case Study: Selecting data Structures 132
13.1 Word Frequency Analysis 132
13.2 Random Number 133
13.3 Word histogram 134
13.4 most commonly used words 135
13.5 optional parameter 136
13.6 Dictionary Subtraction 137
13.7 Random Words 138
13.8 Markov Analysis 138
13.9 Data Structure 140
13.10 Commissioning 141
13.11 Glossary 142
13.12 Exercise 143
Chapter 14th Document 144
14.1 Persistence 144
14.2 Reading and writing 144
14.3 format operator 145
14.4 file name and path 146
14.5 Catching exceptions 147
14.6 Database 148
14.7 Sequestration 149
14.8 Pipe 150
14.9 writing the module 151
14.10 Commissioning 152
14.11 Glossary 152
14.12 Exercise 153
Chapter 15th Class and Object 155
15.1 user-defined type 155
15.2 Properties 156
15.3 Rectangle 157
15.4 as an instance of the return value 158
15.5 objects are variable 159
15.6 Replication 159
15.7 Commissioning 161
15.8 Glossary 161
15.9 Exercise 162
16th chapter classes and Functions 163
16.1 Time 163
16.2 Pure Functions 164
16.3 Modifier 165
16.4 Prototypes and Plans 166
16.5 Commissioning 167
16.6 Glossary 168
16.7 Exercise 168
Chapter 17th class and Method 170
17.1 Object-oriented features 170
17.2 Printing Objects 171
17.3 Another example 172
17.4 A more complex example 173
17.5 Init method 173
17.6 _ _str_ _ Method 174
17.7 operator Overloading 175
17.8 type-based distribution 175
17.9 polymorphic 177
17.10 Interfaces and implementations 177
17.11 Commissioning 178
17.12 Glossary 179
17.13 Exercise 179
Chapter 18th Succession 181
18.1 Card Object 181
Class 18.2 Properties 182
18.3 Comparison Card 183
18.4 Card Set 184
18.5 Printing Plate Group 185
18.6 Adding, deleting, shuffling, and sorting 185
18.7 Inheritance 186
Class 18.8 Figure 188
18.9 Data Encapsulation 189
18.10 Commissioning 190
18.11 Glossary 191
18.12 Exercise 191
19th Python pick Jean 194
19.1-Bar Expression 194
19.2 List Understanding 195
19.3 Generator Expression 196
19.4 any and all 197
19.5 Set-Together 197
19.6 Counter 199
19.7 defaultdict 200
19.8 naming tuples 201
19.9 Collecting keyword Parameters 202
19.10 Glossary 203
19.11 Exercise 203
The 20th Chapter Debugging 205
20.1 Syntax error 205
20.2 Run-time error 207
20.2.1, my program doesn't do anything. 207
20.2.2 my card is dead. 207
20.2.3 Infinite Loop 208
20.2.4 Infinite Recursion 208
20.2.5 Execution Process 208
20.2.6 when I run the program, I get an exception 209
20.2.7 I've added too many print statements, overwhelmed by output 210
20.3 Semantic Error 210
20.3.1 my program is not running correctly 211
20.3.2 I have a huge and complex expression, and it's different than I expected. 211
20.3.3 I have a function, the return value differs from the expected 212
20.3.4 I really really got stuck and I need help 212
20.3.5, I really need help. 212
The 21st chapter Algorithm Analysis 214
21.1 Growth Scale 215
21.2 Python basic Operations Analysis 217
21.3 analysis of the search algorithm 218
21.4 Hash Table 219
21.5 Glossary 223
PostScript 224

: Network Disk Download

Think like a computer scientist Python (2nd edition) pdf

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.