Python can perform a wide variety of mathematical operations. These operations include basic arithmetic, such as addition, subtraction, multiplication, and division. Python is designed to handle mathematical expressions efficiently, making it a powerful tool for calculations. A few common operations are:
+: Addition
-: Subtraction
*: Multiplication
/: Division
Python respects the order of operations, also known as PEMDAS/BODMAS, which stands for:
- Parentheses
- Exponents
- Multiplication and Division
- Addition and Subtraction
This means that Python will first calculate expressions in parentheses, then exponents, and so on. Knowing this order helps when writing more complex expressions.