Think Python: How to think like a Computer Scientist

think python how to think like a computer scientist pdf

Learn to program in Python, and start your journey into Software Development with Think Python: How to think Like a Computer Scientist

The following is a review of the book Think Python: How to Think Like a Computer Scientist by Allen B.Downey.

This Think Python review focuses on learning to break a problem into functions, test assumptions, and debug code. It suits beginners who want a deliberate introduction to programming rather than a collection of automation recipes.

Planning to use Python for machine learning? Read the free Starter Kit excerpt on test sets before your first model. No email required; the full Starter Kit costs €19.

Review

Think Python is one of the greatest books for learning how to program in Python out there. It presents an introduction to computer science, covering the most basic concepts that are common to most languages like variables, data structures, functions, conditionals, and flow control, while visiting software engineering concepts like interface design, GUI based programs, debugging, program development, basic algorithms, and algorithmic complexity.

Compared with Python Crash Course, Think Python puts more emphasis on reasoning through small programs and exercises. Both cover programming fundamentals; choose the format that helps you practise consistently.

Think Python solves this issue by going to a middle ground between a highly practical book (exercises in every chapter and some awesome case studies) and one that teaches the fundamental concepts of software development.

You can use Think Python as your first programming book. You do not need to complete another introduction first. After each exercise, change an input or requirement and explain why the result changes.

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.

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 to program in python within a browser and:

  • 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

The text builds a great progression for learning to program in Python in an easy to follow manner, and using non-trivial and insightful examples that will teach you to think about the language itself and consolidate the knowledge retrieved from the book deep into your brain. We think this is a fantastic way of learning – building from scratch and then trying to get you to think, not just coding like a Machine.

The only caveat we found in this text is that many of the coding exercises are math related, and while they are not hard (if you have a basic background you will be fine), if you do hate math, you will not enjoy them. If this part is an issue for you, we deeply recommend that you complete the exercises and the case studies to really grasp and get the most out of the book.

If you do so, Think Python will set you up for solving a lot of programming tasks.

Illustration of the 90-day machine learning roadmap PDF

Stay on track. Get the Roadmap.

Download the 90-Day Roadmap PDF + get weekly tips and resources to help you succeed

Contents

The outline below reflects an older edition. For a new start, use the official Think Python third edition, which is free online and organized as executable Jupyter notebooks. Keep the text, exercises, and companion code from the same edition.

  • Preface
  • 1. The Way of the Program
  • 2. Variables, Expressions and Statements
  • 3. Functions
  • 4. Case Study: Interface Design
  • 5. Conditionals and Recursion
  • 6. Fruitful Functions
  • 7. Iteration
  • 8. Strings
  • 9. Case Study: Word Play
  • 10. Lists
  • 11. Dictionaries
  • 12. Tuples
  • 13. Case Study: Data Structure Selection
  • 14. Files
  • 15. Classes and Objects
  • 16. Classes and Functions
  • 17. Classes and Methods
  • 18. Inheritance
  • 19. The Goodies
  • 20. Debugging
  • 21. Analysis of Algorithms

Earlier editions have free PDFs on the author’s second-edition page. For the third edition, use the online notebooks and companion repository.

We like having books on Paperback, to write, comment, and have as manuals next to where we work, but having the text available on PDF is really awesome to increase the reach of the text and allow anyone to learn from it.

Summary

Think Python: How to think Like a Computer Scientist is an amazing book for going into serious software development with Python. It is oriented for beginners and people that want to program in python from scratch, but that have the goal of becoming a full software developer.

Pick one introductory book and complete its exercises before adding more reading. For a different style, compare Automate the Boring Stuff with Python and Python Crash Course. Then build a small program without copying a worked solution.

If you are interested in general software development or ‘The Python for Data Science handbook’ if what you are looking for is going into Data Science or Machine Learning.

Anyhow, if you want to learn to program in Python for proper software development, then this is the book for you: it is short, up to the point, lucid, practice oriented, and you can even download it freely online! If you want a paperback copy however, you can find it on Amazon here

We hope you enjoyed the review, thanks for reading and have fun coding!

Subscribe to our awesome newsletter to get the best content on your journey to learn Machine Learning, including some exclusive free goodies!

HOW IS MACHINE LEARNING