Arithmetic Operators#
Most programming languages allow you to perform arithmetic operations and mathematical calculations using arithmetic operators.
Common arithmetic operations (with Python examples) include:
| Name | Python Syntax | Python Example | Description |
|---|---|---|---|
| Addition | + | 5 + 6 | Adds values |
| Subtraction | - | 5 - 6 | Subtracts values |
| Multiplication | * | 5 * 6 | Multiples values |
| Integer division | // | 5 // 6 | Divides values, integers (whole numbers) |
| Float division | / | 5 / 6 | Divides values, floating point numbers (decimal values) |
| Modulo | % | 5 % 6 | Returns or retrieves remainder (whole number) from division operation |
| Exponent | ** | 5 ** 6 | Calculates exponent |
Examples#
We can run arithmetic operations directly in the console or in a script.
# sample arithmetic operation
5 + 7
But we can also assign the output of an arithmetic operation to a variable.
# sample arithmetic operation where output is assigned to variable
x = 5 + 7
# show variable value
print(x)

Python follows the PEDMAS order of operations: parenthesis, exponents, multiplication, division, addition, subtraction.
When in doubt, use parenthesis!
Comprehension Check#
![]() |
Arithmetic Operators Comprehension Check |
Additional Resources
For more on arithmetic operators (in general): “Arithmetic Operators” from Busbee and Braunschweig’s Coding Fundamentals:
For more on arithmetic operators in Python:
Application#
Q2: Write programs (or a single program) that use each of the following arithmetic operators.
Addition
Subtraction
Multiplication
Division
Modulus
Exponents
You can write separate calculations with single operators, or calculations that use multiple operators.
Answer to this question includes program + comments that document process and explain your code.
Q3: Write a program that uses arithmetic operators to convert a specific Farenheit temperature value and output its Celsius representation. Answer to this question includes program + comments that document process and explain your code.
The conversion equation is: celsius = (fahrenheit - 32.0) * 5.0 / 9.0
