Lecture notes · Programming in Python · Lecture 1

Introduction to CS and Programming Using Python

MIT 6.100L Intro to CS and Programming using Python, lecture 1, explained in plain English

Want this lecture to stick? In LessonBound you get checked practice questions for every part, can ask about anything you don't get, and can listen with your screen off. Free, no ads.

Learn this lecture free

Watch or read the original lecture: MIT OpenCourseWare.

Part 1 · 0:00–10:00

This part explains that programming means writing step-by-step recipes for a computer, and that practice and computational thinking are central to the course.

Key ideas

Words to know

declarative knowledge
A statement of fact that says what is true, without saying how to get there.
imperative knowledge
A set of instructions that says how to do something, step by step, like a recipe.
algorithm
A clear sequence of steps that solves a problem or does a task. A recipe is one example.
flow of control
The rules that decide which step comes next, such as repeating steps or choosing between steps based on a check.

Example

A cake recipe is an algorithm. You follow the steps in order, repeat a check with a toothpick until it comes out clean, and then you stop. The computer works the same way: it follows the steps you give it, checks what you told it to check, and stops when you told it to stop.

3 checked practice questions for this part are in the app.

Part 2 · 10:00–20:00

This part explains how computers follow instructions exactly, how programming languages are built from simple pieces, and why a program can run without errors yet still do the wrong thing.

Key ideas

Words to know

interpreter
A program that reads instructions and carries them out, one step at a time.
primitives
The basic building blocks of a language, such as numbers, text, and simple operators, that bigger things are built from.
syntax
The rules for how words and symbols must be put together to make a valid sentence or expression.
static semantic error
A mistake where the code is written correctly but the operation makes no sense, such as adding text and a number.

Example

Think of a recipe card read by a robot cook who does exactly what it says and nothing more. If the card says 'add salt' but you meant 'add sugar', the robot will still add salt, and the dish turns out wrong even though every step was followed perfectly.

3 checked practice questions for this part are in the app.

Part 3 · 20:00–30:00

This part explains that every object in Python has a type that controls what you can do with it, and shows how to check a type and convert (cast) a value from one type to another.

Key ideas

Words to know

type
The category an object belongs to. It tells Python which actions are allowed on that object.
float
A number with a decimal point, such as 3.27 or 2.0. Python treats 2.0 as a float even though it equals 2.
cast
Changing a value into a different type, such as turning the integer 3 into the float 3.0. The original value stays the same.
truncates
Cuts off the decimal part of a number without rounding it up or down.

Example

Think of a type like the category on a kitchen tool. A measuring cup can measure flour, but you cannot use it to hammer a nail. Python's types work the same way: the type of an object tells Python which jobs that object can do.

3 checked practice questions for this part are in the app.

Part 4 · 30:00–40:00

This part explains how Python works out math expressions, what kind of number each result is, and how the order of operations decides what gets calculated first.

Key ideas

Words to know

expression
a piece of code that Python works out to give one value, such as 3 plus 2.
operator
a symbol that does something to values, such as plus, minus, or the percent sign.
truncate
to cut off the decimal part of a number and keep only the whole number. So 1 over 2 becomes 0.
remainder
what is left over after dividing one whole number by another. For 5 divided by 3, the remainder is 2.

Example

Think of a calculator. You type in 13 minus 4, then divide, and the screen shows only the final answer, not every key you pressed. Python works the same way: it keeps the final value and throws away the expression you wrote.

3 checked practice questions for this part are in the app.

Part 5 · 40:00–50:00

This part explains how programs use variables to give names to values, and why clear names and comments make code easier to read.

Key ideas

Words to know

variable
A name that stands for a value stored in the computer's memory. You can use the name anywhere you want that value.
assignment statement
A line of code that gives a value to a name, using the equal sign. The name on the left gets the value on the right.
expression
A piece of code, such as 3 plus 4 or pi times radius, that Python works out into one single value.
comment
A note in the code that starts with a hash. Python skips it when running the program. It is there to help people read the code.

Example

Think of a label on a jar in your kitchen. If the label says sugar, you know what is inside without opening it, and you can find it quickly. A variable name works the same way: a clear name tells you what value it holds, so you do not have to check every line of code to find out.

3 checked practice questions for this part are in the app.

Part 6 · 50:00–1:03:18

This part shows how Python names and values work: a name can be moved to a new value, and each line runs in order.

Key ideas

Words to know

binding
The link between a name and a value. Saying x = 5 binds the name x to the value 5.
assignment
Giving a name a value with the equal sign. In Python, the right side is worked out first, then the result is attached to the name on the left.
evaluate
To work something out until you get a single final value.
garbage collection
A process where Python clears out values that no name points to anymore, to free up memory.

Example

Think of a variable name like a sticky note on a box. When you move the note to a different box, the first box is no longer labeled, and nothing can find it again unless you write the label back on it. This is what happens when a name is rebound to a new value.

3 checked practice questions for this part are in the app.

Lecture 2: Strings, Input/Output, and Branching →

Notes written by AI (Claude) from the lecture's official transcript, so check anything important against the lecture. MIT OpenCourseWare · CC BY-NC-SA 4.0 · not affiliated with or endorsed by MIT. These notes are shared under the same license.

LessonBound · Free lecture notes · Privacy · Terms · New York