Arithmetic Operators
Arithmetic operators are used with numeric values to perform common mathematical operations:
| Operator | Name | Example |
|---|---|---|
| + | Addition | x + y |
| - | Subtraction | x - y |
| * | Multiplication | x * y |
| / | Division | x / y |
| % | Modulus | x % y |
| ** | Exponentiation | x ** y |
| // | Floor division | x // y |
Division in Python
Python has two division operators
- / - Division (returns a float)
- // - Floor division (returns an integer)
Example
x = 12
y = 5
print(x / y)Example
x = 12
y = 5
print(x // y)