Python · Lesson 1 · On the house

You, me, and print

What Python is, and the first line that talks back. Lesson 1 is free — on the house.

Lessons · Python · Lesson 1 of 10 · On the house

You, me, and print

What Python is, and the first line that talks back.

Illustration for the Python course
Lesson 1 is on the house. The rest opens with the paper, the Daily, or a gift.

You're writing instructions for a machine with no common sense and infinite patience: plain text in, interpreter runs it, feedback comes back as output or an error. That write-run-see loop is how you'll learn every later idea — not by memorizing posters. When the traceback shows up, read the last line first, then the file and line number above it. Change one thing. Run again. That calm loop beats rewriting everything from memory. Watch your quotes like a hawk. Straight quotes only. If a chat app curled them into fancy ones, delete and retype. Matching open and close styles saves you a baffling syntax error. Before you run anything, predict what You, me, and print should do on the still's inputs. Prediction turns running into confirmation.

Python's syntax reads closer to English than many languages, but it is still exact. Quotes, parentheses, and capitalization all matter. We start with print because seeing your own words appear is the fastest proof the toolchain works. Watch your quotes like a hawk. Straight quotes only. If a chat app curled them into fancy ones, delete and retype. Matching open and close styles saves you a baffling syntax error. Types are not bureaucracy — they are a shared language between you, your future self, and tooling. Name them aloud when you are learning; fluency comes from the mouth as much as the fingers. Before you run anything, predict what You, me, and print should do on the still's inputs. Prediction turns running into confirmation.

print sends values to standard output. Call it with parentheses. Strings need matching quotes — single or double. print("hello") and print('hello') both work; Print("hello") does not, because names are case-sensitive. Watch your quotes like a hawk. Straight quotes only. If a chat app curled them into fancy ones, delete and retype. Matching open and close styles saves you a baffling syntax error. Types are not bureaucracy — they are a shared language between you, your future self, and tooling. Name them aloud when you are learning; fluency comes from the mouth as much as the fingers. Before you run anything, predict what You, me, and print should do on the still's inputs. Prediction turns running into confirmation.

Running print("hello") writes hello plus a newline. Multiple arguments are separated by spaces. Numbers can print without quotes, but today stay with one quoted string so the shape of a call burns in. Watch your quotes like a hawk. Straight quotes only. If a chat app curled them into fancy ones, delete and retype. Matching open and close styles saves you a baffling syntax error. Types are not bureaucracy — they are a shared language between you, your future self, and tooling. Name them aloud when you are learning; fluency comes from the mouth as much as the fingers. Before you run anything, predict what You, me, and print should do on the still's inputs. Prediction turns running into confirmation.

Misses are gifts: forgotten parentheses, mismatched quotes, bare print hello. Read tracebacks bottom-up. Change one thing. Rerun. Don't rewrite the whole line when one character is wrong. Watch your quotes like a hawk. Straight quotes only. If a chat app curled them into fancy ones, delete and retype. Matching open and close styles saves you a baffling syntax error. Types are not bureaucracy — they are a shared language between you, your future self, and tooling. Name them aloud when you are learning; fluency comes from the mouth as much as the fingers. Before you run anything, predict what You, me, and print should do on the still's inputs. Prediction turns running into confirmation.

You need Python 3 (often python3). Saving isn't running. Avoid curly smart quotes from chat apps. First victory should be boring: one line, clear output, no mystery. Watch your quotes like a hawk. Straight quotes only. If a chat app curled them into fancy ones, delete and retype. Matching open and close styles saves you a baffling syntax error. Before you run anything, predict what You, me, and print should do on the still's inputs. Prediction turns running into confirmation.

Put You, me, and print in a sentence you could teach a friend: what changes in the program, what stays the same, and what output you expect from the still. Types are not bureaucracy — they are a shared language between you, your future self, and tooling. Name them aloud when you are learning; fluency comes from the mouth as much as the fingers. Before you run anything, predict what You, me, and print should do on the still's inputs. Prediction turns running into confirmation.

print

print("hello")
The smallest talking program.

Walk the still: print is the function name; parentheses hold arguments; "hello" is a string literal whose quotes are for Python, not the screen; no semicolon. Output is hello on its own line.

Pitfalls: capital-P Print; smart quotes; empty print() blank line; text outside parentheses; save-without-run. Literal language, calm retries. Keep a scratch file and rerun after every change.

Quiz

What does print do in Python?

Quiz

Which is a valid string literal?

Quiz

Are Python names case-sensitive?

Quiz

Why start with print?

Quiz

What does print("hello") show?

Quiz

Print("hi") raises NameError because?

Check

Type a line that prints hello.

That's lesson one: text in, run, text out. Next we bind names to values. Mark it passed when checks are green — you actually programmed.

Open-book: the answers are on this page. Pass every quiz and check (7) to mark the lesson done. This visit: 0/7.

You, me, and print · Python (free) — The Gold Standard