Lesson 7 of 48
Python: syntax and types
Your first real language, and the discipline of saying what kind of thing you mean.
A type is a promise about what a value can do. Most beginner bugs are a string where a number was meant. Naming types out loud is the cheapest debugging habit you will ever build.
Do this
Write a terminal program that asks for input, branches on it, and does something useful. Then hand it to someone told to break it — it must not crash.
The question that unlocks the next lesson
In Python, `input()` returns the text “12”. What does `input() + 1` do?
- AReturns 13
- BReturns “121”
- CRaises a TypeError — you cannot add an int to a str
- DSilently converts and returns 13.0