Challenge - 5 Problems
Arithmetic Operator Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of mixed arithmetic operations
What is the output of this Python code?
Python
result = 10 + 4 * 3 - 6 / 2 print(result)
Attempts:
2 left
💡 Hint
Remember the order of operations: multiplication and division happen before addition and subtraction.
✗ Incorrect
Multiplication and division are done first: 4*3=12 and 6/2=3. Then addition and subtraction: 10 + 12 - 3 = 19.0
❓ Predict Output
intermediate2:00remaining
Integer division and modulo output
What will be printed by this code?
Python
a = 17 b = 5 print(a // b, a % b)
Attempts:
2 left
💡 Hint
Integer division (//) gives the quotient without remainder, modulo (%) gives the remainder.
✗ Incorrect
17 divided by 5 is 3 with remainder 2, so output is '3 2'.
❓ Predict Output
advanced2:00remaining
Result of chained arithmetic with parentheses
What is the output of this code snippet?
Python
value = (8 + 2) * (5 - 3) ** 2 / 2 print(value)
Attempts:
2 left
💡 Hint
Calculate inside parentheses first, then exponentiation, then multiplication and division.
✗ Incorrect
Inside parentheses: (8+2)=10 and (5-3)=2. Exponentiation: 2**2=4. Then multiply: 10*4=40. Finally divide by 2: 40/2=20.0. Wait, check carefully: The code is (8 + 2) * (5 - 3) ** 2 / 2
So (5-3)**2 = 2**2=4
Then 10 * 4 = 40
Then 40 / 2 = 20.0
So correct output is 20.0, option B.
❓ Predict Output
advanced2:00remaining
Output of negative number exponentiation
What does this code print?
Python
print(-3 ** 2)
Attempts:
2 left
💡 Hint
Exponentiation has higher priority than the unary minus.
✗ Incorrect
The expression is interpreted as -(3 ** 2), so 3**2=9, then unary minus makes it -9.
🧠 Conceptual
expert2:00remaining
Understanding float division precision
What is the output of this code?
Python
result = 0.1 + 0.2 print(result == 0.3)
Attempts:
2 left
💡 Hint
Floating point numbers can have small precision errors.
✗ Incorrect
Due to how computers store floating point numbers, 0.1 + 0.2 is not exactly 0.3, so the comparison is False.