Introduction to Computation and Programming Using Python

  1. Home
  2. Docs
  3. LSE
  4. Department of Mathematics
  5. Introduction to Computation and Programming Using Python

Introduction to Computation and Programming Using Python


Guttag, J. V. (2021). Introduction to Computation and Programming Using Python: With Application to Computational Modeling and Understanding Data (3rd ed.). The MIT Press.

Chapter Summary:

Chapter 1: Getting Started

  • Introduces the basics of computation, the distinction between declarative and imperative knowledge, and the concept of algorithmic problem solving. The role of algorithms in computing is emphasized along with an introduction to Python programming.

Chapter 2: Introduction to Python

  • Covers the fundamentals of Python, including data types, operators, and writing simple programs. The chapter focuses on helping readers understand the syntax and semantics of Python as a programming tool.

Chapter 3: Some Simple Numerical Programs

  • Explores writing basic numerical programs in Python, such as programs that compute square roots and primes. Techniques like exhaustive enumeration, bisection search, and approximation algorithms are discussed.

Chapter 4: Functions, Scoping, and Abstraction

  • Introduces functions, the scoping of variables, and the importance of abstraction in managing complexity in programming.

Chapter 5: Structured Types and Mutability

  • Discusses Python’s structured types such as tuples, lists, and dictionaries, with a focus on mutability and its implications for program behavior.

Chapter 6: Recursion and Global Variables

  • Explains recursion as a method for solving problems that can be defined in terms of simpler versions of the same problem, and discusses the use of global variables.

Chapter 7: Modules and Files

  • Covers how to organize programs into modules and interact with the file system for reading and writing data.

Chapter 8: Testing and Debugging

  • Focuses on methodologies for testing to ensure program correctness and debugging techniques to identify and fix bugs effectively.

Chapter 9: Exceptions and Assertions

  • Introduces exception handling as a method for responding to runtime errors, and the use of assertions as a way to check that the state of a program is as expected during execution.

Chapter 10: Classes and Object-Oriented Programming

  • Discusses the principles of object-oriented programming including classes, objects, inheritance, and polymorphism, using Python to illustrate these concepts.

Chapter 11: A Simplistic Introduction to Algorithmic Complexity

  • Provides an introduction to the concept of algorithmic complexity, discussing how to evaluate the efficiency of algorithms.

Chapter 12: Some Simple Algorithms and Data Structures

  • Reviews basic algorithms and data structures such as sorting and searching, emphasizing their implementation and use in Python.

Chapter 13: Plotting and More About Classes

  • Expands on the use of classes in Python and introduces plotting with libraries like Matplotlib to visualize data.

Chapter 14: Dynamic Programming

  • Key Concept: Utilizing memory to store intermediate results (memoization) to optimize recursive algorithms.
  • Application: Solving optimization problems like the knapsack problem or finding the longest common subsequence.

Chapter 15: Optimization Problems

  • Key Concept: Application of algorithms to find optimal solutions under given constraints.
  • Application: Task scheduling, resource allocation, and network design.

Chapter 16: Random Walks

  • Key Concept: Modeling paths that consist of a sequence of random steps.
  • Application: Financial modeling (e.g., stock price movements), physics (e.g., particle diffusion).

Chapter 17: Probability and Statistics

  • Key Concept: Using statistical methods to analyze data and draw inferences.
  • Application: Hypothesis testing, data analysis, and prediction models.

Chapter 18: Simulating Randomness

  • Key Concept: Simulation of random processes using computational techniques.
  • Application: Risk analysis in insurance and finance, simulations of complex systems like weather patterns.

Chapter 19: Data Visualization

  • Key Concept: Effective presentation of data through visual means.
  • Application: Exploratory data analysis, presentation of results in research and business.

Chapter 20: Monte Carlo Simulations

  • Key Concept: Using randomness to solve problems that might be deterministic in principle.
  • Application: Evaluating financial derivatives, risk assessment in project management.

Chapter 21: Stochastic Programming

  • Key Concept: Incorporating uncertainty directly into decision-making models and algorithms.
  • Application: Supply chain management, inventory control where demand is uncertain.

Chapter 22: Machine Learning Basics

  • Key Concept: Algorithms that allow computers to learn from and make predictions on data.
  • Application: Email spam filtering, recommendation systems.

Chapter 23: More About Machine Learning

  • Key Concept: Enhancing machine learning models to prevent overfitting and underfitting.
  • Application: Improving accuracy of predictive models in various domains like healthcare and finance.

Chapter 24: Neural Networks and Deep Learning

  • Key Concept: Layers of interconnected nodes or neurons that mimic the human brain.
  • Application: Image and speech recognition, autonomous vehicles.

Chapter 25: Natural Language Processing

  • Key Concept: Techniques to enable computers to process and analyze large amounts of natural language data.
  • Application: Chatbots, sentiment analysis, automatic summarization.

Chapter 26: Classification Methods

  • Key Concept: Algorithms that categorize data into predefined classes.
  • Application: Disease diagnosis, customer segmentation, facial recognition.

These chapters comprehensively cover a broad spectrum of computational methods and applications, using Python as a tool to implement and understand these techniques. Each concept is tied to practical examples, demonstrating the power of programming and algorithms in solving complex, real-world problems.

Key Concepts:

1. Fundamentals of Programming with Python:

  • The book begins with a foundational introduction to Python programming, covering basic syntax, data types, control structures, functions, and problem-solving techniques. This includes the setup of a Python programming environment and writing simple scripts.

2. Algorithmic Thinking:

  • A central theme is the development of algorithmic thinking—approaching problems in a methodical and structured way that can be translated into efficient programs. This involves understanding how to break down problems, develop solutions, and then code these solutions in Python.

3. Data Structures:

  • Understanding and using various data structures such as lists, dictionaries, tuples, and sets. The book discusses how to manipulate these structures and the importance of selecting the right structure for a task based on efficiency.

4. Control Structures:

  • Detailed discussions on loops, conditional statements, and exception handling are included, highlighting how these control structures direct the flow of a program based on logical decisions and error conditions.

5. Function Definition and Scoping:

  • Exploring how functions are defined and used in Python, including aspects of parameter passing, return values, and variable scoping rules. Functions are emphasized as a way to achieve modularity and reuse in programming.

6. Object-Oriented Programming:

  • Introduction to object-oriented programming (OOP) principles such as classes, objects, inheritance, and polymorphism, which are crucial for writing modular and scalable code.

7. Recursion:

  • The concept of recursion is explored as a method for solving problems that can naturally be divided into similar subproblems. Recursive thinking is applied to several programming scenarios.

8. Complexity and Big-O Notation:

  • Understanding the computational complexity of algorithms and how to express this complexity using Big-O notation. This includes analyzing the time and space efficiency of algorithms.

9. Algorithm Design Techniques:

  • Introduces several important algorithm design paradigms including greedy algorithms, divide and conquer, and dynamic programming. Each paradigm is discussed with practical examples.

10. Testing and Debugging:

  • Techniques for systematically testing and debugging Python code to ensure it is reliable and behaves as expected. This includes writing test cases and using Python’s debugging tools.

11. File Handling and Serialization:

  • How to manage files and streams in Python, including reading from and writing to files, as well as serializing objects for persistence.

12. Mathematical and Statistical Tools:

  • Application of Python’s capabilities to perform mathematical calculations and statistical analysis, which are integral in many computational applications.

13. Advanced Topics in Computational Modeling and Data Analysis:

  • Covers more advanced topics including machine learning, natural language processing, and data visualization. These chapters introduce libraries like NumPy, Pandas, Matplotlib, and scikit-learn that extend Python’s core capabilities.

14. Real-World Applications:

  • Throughout the book, there is a strong emphasis on applying programming and computational techniques to solve real-world problems, from analyzing stock market trends to simulating random processes and building interactive applications.

This comprehensive overview provides learners with a robust toolkit for tackling diverse programming challenges using Python, emphasizing both practical skills and theoretical understanding.

Critical Analysis:


  1. Comprehensive Introduction to Python: The book provides a thorough introduction to Python programming, starting from the basics and progressing to more advanced topics. This makes it ideal for beginners as well as more experienced programmers looking to deepen their understanding of Python.
  2. Clear and Accessible Writing: Guttag’s writing style is clear and accessible, which helps in demystifying complex programming and computational concepts. His explanations are supplemented with ample examples, making the theoretical content more tangible and understandable.
  3. Emphasis on Practical Application: The book excels in connecting programming concepts with real-world applications. It not only teaches Python syntax but also how to use Python to solve practical problems in areas like data analysis, machine learning, and beyond.
  4. Strong Pedagogical Approach: Each chapter includes exercises and review questions that reinforce learning and ensure that readers can apply what they’ve learned. This educational approach is beneficial for self-learners and students in academic settings alike.


  1. Rapid Progression in Difficulty: While the book starts with basics, the progression to more advanced topics can be quite rapid. This might pose a challenge for readers who are new to programming or those not familiar with foundational mathematical concepts.
  2. Requires Supplemental Learning for Depth: For some advanced topics, such as machine learning and data science, the coverage might be too brief for those seeking to gain a deep expertise. Readers might need additional resources to fully master these areas.
  3. Assumed Background Knowledge: The book sometimes assumes a certain level of mathematical or programming knowledge, which could be a hurdle for absolute beginners or those from non-technical backgrounds.
  4. Updating Frequency: Given the fast pace of development in programming languages and computational techniques, the book could benefit from more frequent updates to stay current with new Python versions and libraries.

Suggestions for Improvement:

  1. Gradual Learning Curve: Introducing more intermediary steps and foundational content in the transition from basic to advanced topics could help mitigate the steep learning curve.
  2. Expand Coverage on Advanced Topics: Providing more in-depth discussion and examples on advanced topics such as deep learning, natural language processing, and others could make the book a more comprehensive resource for advanced learners.
  3. Additional Examples and Case Studies: Including more practical examples and extended case studies, especially for complex topics, could enhance understanding and provide a more hands-on learning experience.
  4. Online Supplementary Materials: Offering access to online resources such as video tutorials, further readings, and interactive exercises could complement the book’s content and support varied learning preferences.

Overall, “Introduction to Computation and Programming Using Python” by John V. Guttag is a valuable resource for anyone looking to understand and apply Python in the real world. Its balanced approach between theory and practice makes it a recommended read for both newcomers and experienced programmers. Enhancements focused on pacing and depth could further improve its utility as a premier educational tool in computational programming.

Real-World Applications and Examples:

Applications in Various Fields:

  1. Data Analysis:
  • The book provides comprehensive tools for data manipulation and analysis using Python libraries such as Pandas and NumPy. These tools are extensively used in industries like finance for analyzing market trends and in healthcare for patient data analysis.
  1. Machine Learning:
  • Python’s application to machine learning is thoroughly explored, illustrating how libraries like scikit-learn can be used for creating predictive models. This is crucial in sectors such as marketing for customer segmentation and in technology for developing intelligent systems.
  1. Web Development:
  • Python’s versatility is highlighted through its use in web development frameworks like Django and Flask, which are employed to build and manage dynamic websites and APIs.
  1. Scientific Computing:
  • The book delves into Python’s use in scientific computing for simulations and computations, widely used in engineering to solve complex problems like fluid dynamics and in environmental science for climate modeling.
  1. Automation:
  • Examples of automating repetitive tasks such as data entry, web scraping, and system administration tasks demonstrate Python’s utility in increasing efficiency and reducing human error.

Example Scenarios Demonstrated in the Book:

  1. Stock Market Analysis:
  • Python is used to download, process, and visualize stock data, helping analysts identify trends and make investment decisions. Techniques like moving averages and other statistical measures are applied to forecast future stock prices.
  1. Healthcare Data Management:
  • The book discusses the application of Python in managing and analyzing healthcare data, such as electronic health records, to improve patient outcomes through more personalized medicine and predictive health analytics.
  1. Environmental Data Visualization:
  • Python’s capabilities in data visualization are applied to environmental data to help scientists and policymakers visualize trends such as increasing global temperatures or pollution levels, aiding in environmental protection efforts.
  1. Social Media Sentiment Analysis:
  • Natural Language Processing (NLP) techniques are employed to analyze social media texts to gauge public sentiment, which can be incredibly valuable for businesses in understanding customer satisfaction and for political analysis.
  1. Automated Trading Systems:
  • The book introduces how Python can be used to develop automated trading systems that can analyze market data in real-time and execute trades based on predefined criteria, optimizing trading strategies and minimizing human error.

These examples illustrate the practical application of Python programming skills taught in the book, showing how they can be applied across different industries to solve real-world problems. This practical application helps bridge the gap between theoretical knowledge and real-world implementation, making Python a valuable skill in the tech-driven modern workplace.

Post a Comment

Your email address will not be published. Required fields are marked *