AI engineering glossary · Python core

What is operator precedence?

Operator precedence (also called order of operations): The fixed order in which Python evaluates operators when an expression has several. Exponentiation comes first, then multiplication and division, then addition and subtraction, then comparisons, then not, and, or. Parentheses override the order.

Level: beginnerTopic: Python core

Operator precedence: an example

2 + 3 * 4 gives 14, not 20, because * binds tighter than +. (2 + 3) * 4 gives 20.

Related terms

More Python core terms

Where you learn it

Operator precedence is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.