Topic: Learning notes
MIT 6.100L Lecture 1: Introduction
Study notes for MIT OpenCourseWare 6.100L Lecture 1, covering computational thinking, Python objects, expressions, variables, and programming style.
Welcome to the world of computer science! This article is based on Lecture 1 of MIT 6.100L. The core goal of this course is not only to learn Python, but more importantly to build computational thinking so you can reason about how to use computation to solve problems.
1. Two forms of knowledge: declarative vs. imperative
Before we write code, we need to distinguish two kinds of knowledge:
- Declarative knowledge: statements of facts. Example: “the square root of x is y such that y*y = x.” It tells us what the result is but not how to obtain it.
- Imperative knowledge: a “recipe” or concrete steps that tell you how to do something.
Programming is essentially writing a series of instructions (a recipe) for a computer to produce facts.
What is an algorithm?
An algorithm is a detailed sequence of instructions that includes:
- A set of simple steps.
- Flow of control: specifies when each step is executed.
- A stopping criterion: determines when the computation ends.
2. What computers really are and Turing’s insight
Many people think computers are smart, but in reality they are quite dumb. They do not make decisions on their own; they only execute the precise instructions given by humans. Their strengths are blazing-fast computation and massive storage.
Alan Turing and six primitive operations
Long ago, Alan Turing proved that with just six primitive operations, you can compute anything that is computable. These operations include:
- Move left
- Move right
- Read/scan the value on the tape
- Write/print a value on the tape
- Erase a value
- No operation
This leads to a powerful idea: anything that is computable in one programming language is computable in any other programming language.
3. Three levels of the Python language
You can think about a programming language at three levels:
- Syntax: which symbol combinations are legal.
- Static semantics: whether a legal expression is meaningful. For example,
"hi" + 5is syntactically valid but causes an error in Python. - Semantics: the actual meaning of a program. In Python, a correct program has exactly one meaning, but that might not be what the programmer intended, which is why bugs happen.
4. Basic Python objects and types
In Python, programs operate on objects. Every object has a type that determines what operations you can perform.
Scalar objects
- int: integers (e.g., 5, -100).
- float: real/floating-point numbers (e.g., 3.27, 2.0).
- bool: Boolean values (True and False).
- NoneType: a special value called None.
Casting
You can force a type conversion, for example float(3) becomes 3.0. int(3.9) truncates the decimal part and becomes 3, not rounded.
5. Expressions and variable assignment
Expressions
Expressions are made of objects and operators. Python evaluates an expression and stores the value, not the expression itself. The result of / is always a float.
Variables and assignment
In computer science, the equals sign = means assignment, not mathematical equality.
- Assignment steps: evaluate the expression on the right, then bind the result to the variable on the left.
- Execution order: programs run line by line. If you change a basis value (like a radius) but do not re-run the formula, results (like area) do not update automatically.
6. Good programming style
- Choose descriptive names: use
radiusinstead of a single letter liker. - Use comments: start with
#to explain the logic or intent of code to readers.
External references
The following links can help you dive deeper into the course content and related concepts:
Turing machines and computation theory
- Stanford Encyclopedia of Philosophy: Turing Machines (a deep dive into the theoretical foundations of Turing machines)
- Introduction to Turing Machines - GeeksforGeeks (a more approachable overview of how Turing machines work)
Official course resources
Python learning tools
- Python official documentation
- Python Tutor (the course-recommended code visualization tool that is great for seeing how variable bindings change)
Analogy: A computer is like a chef who is incredibly fast and has an amazing memory, but absolutely no common sense. You must tell it every step precisely (e.g., “beat the eggs before stirring”) for it to produce a perfect dish.