Introduction to Python

Arithmetic Operators

Lesson 4: Variables and Data Types

Arithmetic Operators in Python

Python supports all standard mathematical operations through arithmetic operators. These allow you to perform calculations on numbers and variables in your programs.

Colorful icons of the plus, minus, multiply, divide, and percent symbols arranged in a row on a bright background

Python Arithmetic Operators

OperatorSymbolExampleResult
Addition+5 + 38
Subtraction-9 - 45
Multiplication*6 * 318
Division/10 / 33.3333...
Floor Division//10 // 33
Modulo%10 % 31
Exponentiation**2 ** 416

Order of Operations

Python follows the standard mathematical order of operations — often remembered as PEMDAS (Parentheses, Exponents, Multiplication/Division, Addition/Subtraction).

PEMDAS pyramid diagram showing the order of operations from top to bottom — Parentheses, Exponents, Multiplication and Division, Addition and Subtraction

# Order of operations example result = 2 + 3 * 4 # result = 14 (not 20) result = (2 + 3) * 4 # result = 20 result = 2 ** 3 + 1 # result = 9

Augmented Assignment Operators

Python also has shorthand operators that combine arithmetic with assignment:

Augmented Assignment Operators

OperatorExampleEquivalent To
+=x += 5x = x + 5
-=x -= 3x = x - 3
*=x *= 2x = x * 2
/=x /= 4x = x / 4
**=x **= 2x = x ** 2
The difference between / and //: regular division (/) always returns a float, while floor division (//) returns the whole number part only, discarding the remainder.

Subscribe to our newsletter.

Get updates to news and events.