compound expressions and operator precedence programming languages must have clear rules for the order in which compound expressionssuch as are evaluated the formal order of precedence for operators in python is given in table operators in category with higher precedence will be evaluated before those with lower precedenceunless the expression is otherwise parenthesized thereforewe see that python gives precedence to multiplication over additionand therefore evaluates the expression as ( )with value but the parenthesized expression ( evaluates to value operators within category are typically evaluated from left to rightthus has value exceptions to this rule include that unary operators and exponentiation are evaluated from right to left python allows chained assignmentsuch as to assign multiple identifiers to the rightmost value python also allows the chaining of comparison operators for examplethe expression < < is evaluated as the compound ( < yand ( < )but without computing the intermediate value twice operator precedence type symbols member access expr member function/method calls exprcontainer subscripts/slices exprexponentiation unary operators +expr-expr~expr multiplicationdivision ///additionsubtraction +bitwise shifting bitwise-and bitwise-xor bitwise-or comparisons isis not==!=>containment innot in logical-not not expr logical-and and logical-or or conditional val if cond else val assignments =+=-==etc table operator precedence in pythonwith categories ordered from highest precedence to lowest precedence when statedwe use expr to denote literalidentifieror result of previously evaluated expression all operators without explicit mention of expr are binary operatorswith syntax expr operator expr