Variables, Types & Operators · Question 6 · Easy

Applying the usual operator precedence, what does this arithmetic expression print?

print(3 + 4 * 2 - 1)
  1. 10
  2. 13
  3. 7
  4. 14
Answer and explanation

Answer: A. 10

Explanation: Multiplication is done before addition and subtraction: 4 * 2 = 8. Then 3 + 8 - 1 = 10, working left to right.

Previous: Which operator raises a number to a power in Python? · Next: An integer is added to a float. What does Python print for the sum?

Practise variables, types & operators

Try a fresh set of variables, types & operators questions with an explanation after every answer, free and without signing up: Variables, Types & Operators practice. Or sit a full placement mock test.

More variables, types & operators questions

More python practice

Python Strings · Lists & Tuples · Dictionaries & Sets · Conditions & Loops · Functions & Scope · Comprehensions & Generators · Classes & Objects · Exceptions & Files

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge