Python Math Operators Flashcards
+
Plus
-
Minus
/
Slash
*
Asterisk
%
Modulus - “X divided by Y with J remaining.” For example, “100 divided by 16 with 4 remaining.” The result of % is the J part, or the remaining part.
<
Less-Than
>
Greater-Than
<=
Less-Than-Equal
> =
Greater-Than-Equal
Pemdas
Parentheses Exponents Multiplication Division Addition Subtraction.
That’s the order Python follows as well.
The mistake people make with PEMDAS is to think this is a strict order, as in “Do P, then E, then M, then D, then A, then S.”
The actual order is you do the multiplication and division (M&D) in one step, from left to right, then you do the addition and subtraction in one step from left to right.
So, you could rewrite PEMDAS as PE(M&D)(A&S).