Caffeinated Coder
Book an appointment
Lesson 06 · First steps in code

Variables and types

A program has to remember things: a score, a price, a name. It does that with variables, names that point to values stored in memory. Step through seven lines of Python and watch each value land in memory, get read back, get replaced, and see why the type of a value decides what + does.

9 min8 steps5 questionsBeginner
Fig 6 · Interactive
Loading figure…
or ← →
Put it into practice

Try it

0/2 exercises passed

Turn text into a number

The value "3" is text. Convert it to an integer before adding 4, so total is the number 7.

Ctrl/Cmd + Enter to run. Tab indents; Escape then Tab leaves the editor.

Ready
Output
Run your code to see its output.
Checks
  • Check your code when you’re ready.

Quiz Unlocks after the last step.