Python Arithmetic Operators
Use Python arithmetic operators to perform calculations such as addition, subtraction, multiplication, and division.
Python Arithmetic Operators at a Glance
Arithmetic operators are one of the Python operator families. They combine numeric values in an expression and return a calculated result.
Basic calculations
Use +, -, *, and / for everyday arithmetic.
Remainders and powers
Use % to find a remainder and ** to raise a value to a power.
Whole-number quotient
Use // when you need division rounded down to the closest integer value.
In This Lesson
1. Arithmetic Operator Cheat Sheet
Use this visual reference to connect each arithmetic symbol with its purpose, expression, and result.
2. Addition
We can add two or more numbers together:
Python interpreter
>>> 1 + 1
23. Subtraction
Subtract one value from another:
Python interpreter
>>> 5 - 1
44. Multiplication
We can also multiply two values:
Python interpreter
>>> 4 * 4
165. Division
Use the forward slash to divide one number by another:
Python interpreter
>>> 9 / 3
3.06. Modulus
We can calculate the remainder of a division:
Python interpreter
>>> 11 % 3
27. Exponentiation
Exponential calculations are also possible:
Python interpreter
>>> 2 ** 8
2568. Floor Division
Floor division returns a result rounded down to the closest integer value:
Python interpreter
>>> 16 // 3
59. Conclusion
You have now learned how to perform calculations in Python with arithmetic operators:
- Addition: Add two or more numbers together.
- Subtraction: Subtract numbers.
- Multiplication: Multiply two or more numbers.
- Division: Divide two numbers.
- Modulus: Calculate the remainder of a division.
- Exponentiation: Perform an exponentiation calculation.
- Floor Division: Return a result rounded down to the closest integer value.
I hope you enjoyed this lesson. If you have any questions, feel free to leave a comment.
Python Arithmetic Operators Frequently Asked Questions
What are Python arithmetic operators?
They are symbols that perform numeric calculations such as addition, subtraction, multiplication, division, remainder, exponentiation, and floor division.
What is the difference between division and floor division?
The / operator returns a floating-point quotient. The // operator rounds the quotient down to the nearest integer value.
What does the modulus operator do?
The % operator returns the remainder after division. For example, 11 % 3 returns 2.