Think Python


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 one step at a time, beginning with basic programming concepts before moving on to functions, recursion, data structures, and object-oriented design.

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, ...

See more details below
$40.84 price
(Save 9%)$44.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (16) from $23.44   
  • New (11) from $25.09   
  • Used (5) from $23.44   
Think Python

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$22.49 price
(Save 42%)$38.99 List Price


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 one step at a time, beginning with basic programming concepts before moving on to functions, recursion, data structures, and object-oriented design.

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.

  • Start with the basics, including language syntax and semantics
  • Get a clear definition of each programming concept
  • Learn 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
Read More Show Less

Product Details

  • ISBN-13: 9781449330729
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 8/27/2012
  • Edition number: 1
  • Pages: 300
  • Sales rank: 178,340
  • Product dimensions: 7.00 (w) x 9.10 (h) x 0.70 (d)

Meet the Author

Allen Downey is an Associate Professor of Computer Science at the Olin College of Engineering. He has taught computer science at Wellesley College, Colby College and U.C. Berkeley. He has a Ph.D. in Computer Science from U.C. Berkeley and Master’s and Bachelor’s degrees from MIT.

Read More Show Less

Table of Contents

The Strange History of This Book;
Contributor List;
Chapter 1: 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 Debugging;
1.11 Glossary;
1.12 Exercises;
Chapter 2: Variables, Expressions, and Statements;
2.1 Values and Types;
2.2 Variables;
2.3 Variable Names and Keywords;
2.4 Operators and Operands;
2.5 Expressions and Statements;
2.6 Interactive Mode and Script Mode;
2.7 Order of Operations;
2.8 String Operations;
2.10 Debugging;
2.11 Glossary;
2.12 Exercises;
Chapter 3: Functions;
3.1 Function Calls;
3.2 Type Conversion Functions;
3.3 Math Functions;
3.4 Composition;
3.5 Adding New Functions;
3.6 Definitions and Uses;
3.7 Flow of Execution;
3.8 Parameters and Arguments;
3.9 Variables and Parameters Are Local;
3.10 Stack Diagrams;
3.11 Fruitful Functions and Void Functions;
3.12 Why Functions?;
3.13 Importing with from;
3.14 Debugging;
3.15 Glossary;
3.16 Exercises;
Chapter 4: Case Study: Interface Design;
4.1 TurtleWorld;
4.2 Simple Repetition;
4.3 Exercises;
4.4 Encapsulation;
4.5 Generalization;
4.6 Interface Design;
4.7 Refactoring;
4.8 A Development Plan;
4.9 Docstring;
4.10 Debugging;
4.11 Glossary;
4.12 Exercises;
Chapter 5: Conditionals and Recursion;
5.1 Modulus Operator;
5.2 Boolean Expressions;
5.3 Logical Operators;
5.4 Conditional Execution;
5.5 Alternative Execution;
5.6 Chained Conditionals;
5.7 Nested Conditionals;
5.8 Recursion;
5.9 Stack Diagrams for Recursive Functions;
5.10 Infinite Recursion;
5.11 Keyboard Input;
5.12 Debugging;
5.13 Glossary;
5.14 Exercises;
Chapter 6: Fruitful Functions;
6.1 Return Values;
6.2 Incremental Development;
6.3 Composition;
6.4 Boolean Functions;
6.5 More Recursion;
6.6 Leap of Faith;
6.7 One More Example;
6.8 Checking Types;
6.9 Debugging;
6.10 Glossary;
6.11 Exercises;
Chapter 7: Iteration;
7.1 Multiple Assignment;
7.2 Updating Variables;
7.3 The while Statement;
7.4 break;
7.5 Square Roots;
7.6 Algorithms;
7.7 Debugging;
7.8 Glossary;
7.9 Exercises;
Chapter 8: Strings;
8.1 A String Is a Sequence;
8.2 len;
8.3 Traversal with a for Loop;
8.4 String Slices;
8.5 Strings Are Immutable;
8.6 Searching;
8.7 Looping and Counting;
8.8 String Methods;
8.9 The in Operator;
8.10 String Comparison;
8.11 Debugging;
8.12 Glossary;
8.13 Exercises;
Chapter 9: Case Study: Word Play;
9.1 Reading Word Lists;
9.2 Exercises;
9.3 Search;
9.4 Looping with Indices;
9.5 Debugging;
9.6 Glossary;
9.7 Exercises;
Chapter 10: Lists;
10.1 A List Is a Sequence;
10.2 Lists Are Mutable;
10.3 Traversing a List;
10.4 List Operations;
10.5 List Slices;
10.6 List Methods;
10.7 Map, Filter, and Reduce;
10.8 Deleting Elements;
10.9 Lists and Strings;
10.10 Objects and Values;
10.11 Aliasing;
10.12 List Arguments;
10.13 Debugging;
10.14 Glossary;
10.15 Exercises;
Chapter 11: Dictionaries;
11.1 Dictionary as a Set of Counters;
11.2 Looping and Dictionaries;
11.3 Reverse Lookup;
11.4 Dictionaries and Lists;
11.5 Memos;
11.6 Global Variables;
11.7 Long Integers;
11.8 Debugging;
11.9 Glossary;
11.10 Exercises;
Chapter 12: Tuples;
12.1 Tuples Are Immutable;
12.2 Tuple Assignment;
12.3 Tuples as Return Values;
12.4 Variable-Length Argument Tuples;
12.5 Lists and Tuples;
12.6 Dictionaries and Tuples;
12.7 Comparing Tuples;
12.8 Sequences of Sequences;
12.9 Debugging;
12.10 Glossary;
12.11 Exercises;
Chapter 13: Case Study: Data Structure Selection;
13.1 Word Frequency Analysis;
13.2 Random Numbers;
13.3 Word Histogram;
13.4 Most Common Words;
13.5 Optional Parameters;
13.6 Dictionary Subtraction;
13.7 Random Words;
13.8 Markov Analysis;
13.9 Data Structures;
13.10 Debugging;
13.11 Glossary;
13.12 Exercises;
Chapter 14: Files;
14.1 Persistence;
14.2 Reading and Writing;
14.3 Format Operator;
14.4 Filenames and Paths;
14.5 Catching Exceptions;
14.6 Databases;
14.7 Pickling;
14.8 Pipes;
14.9 Writing Modules;
14.10 Debugging;
14.11 Glossary;
14.12 Exercises;
Chapter 15: Classes and Objects;
15.1 User-Defined Types;
15.2 Attributes;
15.3 Rectangles;
15.4 Instances as Return Values;
15.5 Objects Are Mutable;
15.6 Copying;
15.7 Debugging;
15.8 Glossary;
15.9 Exercises;
Chapter 16: Classes and Functions;
16.1 Time;
16.2 Pure Functions;
16.3 Modifiers;
16.4 Prototyping Versus Planning;
16.5 Debugging;
16.6 Glossary;
16.7 Exercises;
Chapter 17: Classes and Methods;
17.1 Object-Oriented Features;
17.2 Printing Objects;
17.3 Another Example;
17.4 A More Complicated Example;
17.5 The init Method;
17.6 The __str__ Method;
17.7 Operator Overloading;
17.8 Type-Based Dispatch;
17.9 Polymorphism;
17.10 Debugging;
17.11 Interface and Implementation;
17.12 Glossary;
17.13 Exercises;
Chapter 18: Inheritance;
18.1 Card Objects;
18.2 Class Attributes;
18.3 Comparing Cards;
18.4 Decks;
18.5 Printing the Deck;
18.6 Add, Remove, Shuffle, and Sort;
18.7 Inheritance;
18.8 Class Diagrams;
18.9 Debugging;
18.10 Data Encapsulation;
18.11 Glossary;
18.12 Exercises;
Chapter 19: Case Study: Tkinter;
19.1 GUI;
19.2 Buttons and Callbacks;
19.3 Canvas Widgets;
19.4 Coordinate Sequences;
19.5 More Widgets;
19.6 Packing Widgets;
19.7 Menus and Callables;
19.8 Binding;
19.9 Debugging;
19.10 Glossary;
19.11 Exercises;
Syntax Errors;
Runtime Errors;
Semantic Errors;
Analysis of Algorithms;
Order of Growth;
Analysis of Basic Python Operations;
Analysis of Search Algorithms;
State Diagram;
Stack Diagram;
Object Diagrams;
Function and Class Objects;
Class Diagrams;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)