Expressions and Arithmetic
Expressions and Arithmetic
Operators
The following are common operators you can use to form an
expression in Python:
Unary - Negation. -y
+ Addition x+y
- Subtraction x-y
• Multiplication x*y
/ Division x/y
X and y in the examples are called the left and right operands
respectively.
% modulo x%y
** exponentiation x**y
Operator overloading
3. operator associativity:
Left associativity: left operand first
Statement vs Expression