Python Easy · Lesson 1 · On the house

Types you can see

int, float, str, bool — name them aloud. Lesson 1 is free — on the house.

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

Types you can see

int, float, str, bool — name them aloud.

Illustration for the Python course
int, float, str, bool — name them aloud.

You've finished Introductory habits: print, names, strings, lists, if, loops, dicts, functions, and with-open files. Easy sharpens those tools without throwing away what you already traced on paper.

Python values have types even when you don't declare them. type(3) reports int; type(3.5) float; type("a") str; bool is True/False. Naming types aloud stops the fog where everything feels like "just stuff." 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 Types you can see should do on the still's inputs. Prediction turns running into confirmation.

Ints are whole numbers; floats approximate reals (binary fractions can surprise later). str holds text. Treat bool as yes/no. Use type() in the REPL when unsure what you actually hold. 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 Types you can see should do on the still's inputs. Prediction turns running into confirmation.

Operations care about types. "3"+"4" → "34"; 3+4 → 7. int("3") parses; str(3) goes back. float("3.5") works; int("3.5") fails — convert thoughtfully. 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. 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 Types you can see should do on the still's inputs. Prediction turns running into confirmation.

Truthy/falsy: 0, "", [], {}, None are falsy; most else truthy. Prefer explicit comparisons while learning unless you mean emptiness checks. Trace one full iteration on paper with a tiny example. If you can't simulate a single pass, a thousand passes won't magically clarify it. Before you run anything, predict what Types you can see should do on the still's inputs. Prediction turns running into confirmation.

isinstance(x, int) asks without printing class reprs. type() explores; isinstance plays nicer with inheritance. Today print(type(...)) to see labels. 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. Disk is slower and more permanent than memory. Be deliberate about modes, paths, and closing. Prefer with-blocks so cleanup isn't a hope. Before you run anything, predict what Types you can see should do on the still's inputs. Prediction turns running into confirmation.

Don't fear types — they explain TypeErrors. When + fails between str and int, type() on each side tells you why in one glance. 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. 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 Types you can see should do on the still's inputs. Prediction turns running into confirmation.

Put Types you can see 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 Types you can see should do on the still's inputs. Prediction turns running into confirmation.

If you are skimming, stop and re-read the still's lines in order while pointing at each token. Types you can see is not a vocabulary flashcard — it is a behavior you should be able to simulate on paper.

When an exercise asks you to match the still, match it honestly: same names, same structure, same output idea. Clever shortcuts that skip the concept will leave a hole that the next lesson falls into.

Open-book does not mean guess. The right answer is on this page in plain language. Wrong choices are usually near-misses that sound technical; pick the claim that matches what we actually traced.

types

print(type(3))
print(type(3.5))
print(type("a"))
Ask each value what it is.

Three prints: type(3)→int, type(3.5)→float, type("a")→str. Output uses <class '...'> reprs. Literals carry types; no variables required.

Pitfalls: treating "3" as int; float rounding myths; Type vs type; type(x)==list vs isinstance; forgetting bool when conditions feel magical.

Quiz

type(3) reports?

Quiz

type(3.5) is?

Quiz

type("a") is?

Quiz

What is "3" + "4"?

Quiz

Which converts text to an integer?

Quiz

Is 0 truthy?

Check

Match the still: print types of 3, 3.5, and "a".

You can name what a value is. Next: f-strings — braces as a window into a value.

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

Types you can see · Python Easy (free) — The Gold Standard