Skip to main content

Chapter 15: Operators, Keywords, and Variables

Learning with AI as Your Partner

In Chapter 14, you learned about Python's core data types and how to store data in variables with type hints. Now it's time to learn what you can DO with that data using operators—the symbols that tell Python to perform actions.

What You'll Learn

By the end of this chapter, you will:

  • Perform calculations with arithmetic operators (+, -, *, /, //, %, **)
  • Ask True/False questions with comparison operators (==, !=, >, <, >=, <=)
  • Combine conditions with logical operators (and, or, not)
  • Update variables with assignment operators (=, +=, -=, *=, /=)
  • Recognize Python's 35 reserved keywords and avoid using them as variable names
  • Build a complete calculator integrating all operator types with type validation

Operators are the verbs of programming. In Chapter 14, you learned the nouns (data types). Now you learn the verbs (operators). In Chapter 17, you'll combine them into sentences (control flow).