April 2024
Beginner to intermediate
500 pages
24h 20m
English
Python has three numeric data types:
Integers
Floating-point numbers
Complex numbers
Table B.2 shows the most common operators for numeric data types.
Table B.2 Arithmetic Operators in Python
| Operation | Operator | Explanation |
|---|---|---|
| Addition | + | Calculates the sum of two values. |
| Subtraction | - | Calculates the difference between two values. |
| Multiplication | * | Calculates the product of two values. |
| Floating-point division | / | Calculates the quotient of two values. |
| Integer division | // | Calculates the integer quotient. |
| Modulo | % | Finds the remainder after performing a division. |
| Exponentiation | ** | Raises a number to a power. Example: (x ** y) is equivalent to xy. |
Read now
Unlock full access