Chapter 2

Names, Values, and Types

Assignment, numbers, strings, booleans, None, expressions, statements, and type inspection.

Subject
Python
Lessons
6 lessons
Practice
11 checks
Review
3 pages

What this chapter does

After a reader can run code, the next step is to understand what code stores and manipulates. This chapter teaches names as handles for values and types as a practical debugging tool.

Lessons

Read these in order.

The chapter opening gives the main idea. Move through these lessons next; each page reuses ideas from the pages before it.

  1. 01
    Names and Assignment

    Assignment as the action of making a name refer to a value.

  2. 02
    Numbers and Arithmetic

    Integers, floats, arithmetic operators, precedence, and visible computation.

  3. 03
    Strings and Text

    Text values, joining strings, f-strings, and the difference between text and numbers.

  4. 04
    Booleans and None

    True, False, comparisons, and None as intentional absence.

  5. 05
    Expressions and Statements

    Expressions as value producers and statements as executable instructions.

  6. 06
    Inspecting Types

    Using type() to inspect surprising values before guessing.

  1. Conclusion

    What names, values, and types prepare before branches and loops.

  2. Review

    A compact review of assignment, numbers, strings, booleans, None, expressions, and types.

  3. Exercises

    Chapter-level practice for tracking names, distinguishing types, and fixing type surprises.

You are ready when

  • Assign values to names and track reassignment.
  • Compute with numbers and arithmetic expressions.
  • Use strings, booleans, and None deliberately.
  • Separate expressions from statements.
  • Inspect types when a value behaves unexpectedly.

Where this leads

  • Branches and Loops
  • Functions
  • Collections and Iteration

Chapter progress