01) An operator is a symbol that determines an operation to perform. The operator along with its arguments (operands) forms an expression that is subject to evaluation and provides a result.
02) There are three basic groups of operators in Python:
arithmetic, whose arguments are numbers;
string, which operates on strings or strings and numbers;
Boolean, which expects that their arguments are Boolean values.
03) A unary operator is an operator with only one operand.
04) A binary operator is an operator with two operands.
Unary arithmetic operators
Binary arithmetic operators (ordered according to descending priority)
Priority
Operator
Name
Example
Meaning
Result
Result Type
int if both arguments are ints
int if both arguments are ints
raises ZeroDivisionError when divider is zero
int if both arguments are ints
raises ZeroDivisionError when divider is zero
int if both arguments are ints
raises ZeroDivisionError when divider is zero
int if both arguments are ints
int if both arguments are ints
pairs of parentheses can be used to change the order of operations, for example:
2 + 3 * 4 evaluates to 24
(2 + 3) * 4 evaluates to 20
when operators of the same priority (other than **) are placed side-by-side in the same expression, they are evaluated from left to right: therefore, the expression:
evaluates to 1.0, not to 0.25.
This convention is called left-sided binding.
when more than one ** operator is placed side-by-side in the same expression, they are evaluated from right to left: therefore, the expression:
evaluates to 256 (28), not to 64 (43) β this is right-sided binding.