Book Description
If you want to learn how to program, working with Python is an excellent way to start. This hands-on guide takes you through the language a step at a time, beginning with basic programming concepts before moving on to functions, recursion, data structures, and object-oriented design. This second edition and its supporting code have been updated for Python 3.
Through exercises in each chapter, you'll try out programming concepts as you learn them. Think Python is ideal for students at the high school or college level, as well as self-learners, home-schooled students, and professionals who need to learn programming basics. Beginners just getting their feet wet will learn how to start with Python in a browser.
Start with the basics, including language syntax and semantics; Get a clear definition of each programming concept; Learn about values, variables, statements, functions, and data structures in a logical progression; Discover how to work with files and databases; Understand objects, methods, and object-oriented programming; Use debugging techniques to fix syntax, runtime, and semantic errors; Explore interface design, data structures, and GUI-based programs through case studies.
This open book is licensed under a Creative Commons License (CC BY-NC). You can download Think Python ebook for free in PDF format (1.6 MB).
Table of Contents
Preface
v
Chapter 1
The way of the program
1
Chapter 2
Variables, expressions and statements
9
Chapter 3
Functions
17
Chapter 4
Case study: interface design
29
Chapter 6
Fruitful functions
51
Chapter 7
Iteration
63
Chapter 8
Strings
71
Chapter 9
Case study: word play
83
Chapter 10
Lists
89
Chapter 11
Dictionaries
103
Chapter 12
Tuples
115
Chapter 13
Case study: data structure selection
125
Chapter 14
Files
137
Chapter 15
Classes and objects
147
Chapter 16
Classes and functions
155
Chapter 17
Classes and methods
161
Chapter 18
Inheritance
171
Chapter 19
The Goodies
183
Appendix A
Debugging
193
Appendix B
Analysis of Algorithms
201