Skip to main content

What are operators?

Operators are symbols that perform operations on values. Think of them as the “verbs” of programming - they make things happen! You already know most operators from math class:
  • Calculate: +, -, *, /
  • Compare: >, <, ==
  • Combine: and, or, not

Arithmetic operators

These work just like your calculator:

Order of operations

Python follows math rules (PEMDAS):

Comparison operators

These compare values and return True or False:
Don’t confuse = (assignment) with == (comparison)!
  • age = 18 stores 18 in age
  • age == 18 checks if age equals 18

Logical operators

These combine boolean values and conditions:

Truth tables

Understanding how and, or, and not work:

Assignment shortcuts

These shortcuts update variables in place:

Common mistakes

What’s next?

You know operators! Let’s dive deeper into working with text strings.

String manipulation

Advanced text operations