Step 1 of 7

Step 1 · Read and run

Which goes first?

What's 2 + 3 * 4? If you add first you get 20. If you multiply first you get 14.

Python follows the same order as in maths (you may know it as BIDMAS or BODMAS):

  1. Brackets first.
  2. Then powers: **
  3. Then *, /, // and %, working from left to right.
  4. Then + and -, working from left to right.

So 2 + 3 * 4 multiplies first: 2 + 12 = 14. Brackets let you change that: (2 + 3) * 4 adds first.

Run it.

Run the program to carry on.
order.py

Output

Press Run to see what your program prints.