Q.What will be the output of the following statement: print(165/42/5-8) (A) -3.33 (B) 6.0 (C) 0.0 (D) -13.33
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →* and / have equal precedence and are evaluated left to right; true division (/) always returns a float in Python 3. The chain collapses 16*5 → 80, /4 → 20.0, *2 → 40.0, /5 → 8.0, −8 → 0.0 — option (C).
Concept — precedence and associativity
In Python, * and / share the same precedence level and are left-associative: with no parentheses, the interpreter simply works through them in the order they appear. - (subtraction) has lower precedence, so it is applied last. One more Python-3 fact decides the form of the answer: the / operator performs true division and always returns a float, so the final result is 0.0, not the integer 0.
Step-by-step evaluation
Expression: 16*5/4*2/5-8
| Step | Operation | Result | Expression remaining |
|---|---|---|---|
| 1 | 16 * 5 | 80 | 80/4*2/5-8 |
| 2 | 80 / 4 | 20.0 (float — / divides truly) | 20.0*2/5-8 |
| 3 | 20.0 * 2 | 40.0 | 40.0/5-8 |
| 4 | 40.0 / 5 | 8.0 | 8.0-8 |
| 5 | 8.0 - 8 | 0.0 | done |
Runnable check:
print(16*5/4*2/5-8)
Expected output:
0.0
Why the other options are wrong …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.