Python Order of Operations
PEMDAS
Parentheses Exponents Multiplication Division Addition Subtraction
Addition
+
5 + 2 = 7
Subtraction
-
5 - 2 = 3
Multiplication
*
2 * 3 = 6
Division
/
6 / 3 = 2
Modular division (Remainder)
%
5 % 2 = 1
Exponential
**
5 ** 2 = 25
Floor division
//
5 // 2 = 2
The assignment operator
=
Add and reassign.
+=
Subtract and reassign.
-=
Multiply and reassign.
*=
Divide and reassign
/=
Modular division and reassign
%=
Floor division and reassign.
//=
Exponential and reassign
**=
Equal
==
Not equal
!=
Greater than
>
Less than
Greater than or equal
> =
Less than or equal
<=
and
Returns true if both arguments are true
&
or
Returns true if either input is true.
|