Every program needs to store data — a name, a count, a temperature, a price. Python stores data in variables, and every variable has a type that tells Python what kind of value it holds.

This section covers the building blocks: numbers, text, booleans, and how to move between them.

What’s in this section

  1. Variables and naming — how to create variables and name them well
  2. Numbers — integers and floats
  3. BooleansTrue and False
  4. Strings — text, escape sequences, and f-strings
  5. Type conversion — turning one type into another
  6. Input and output — reading from the keyboard and printing to the screen

If you’ve never programmed before, this section matters most. Type out the examples, run them, and change them on purpose to see what breaks. That’s how the language sticks.

Toggle theme (T)