Skip to content
Worked Examples · Example 5.12

Q.Example 5.12: How will the following expression be evaluated in Python?
15.0 / 4 + (8 + 3.0)

Uttarakhand UbseTextbookSubjective· 2mImportance★★★★★est
47% · 23/49 Questions
🔒 Locked · start free trial →

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 →

Parentheses first (8 + 3.0 = 11.0), then the division (15.0/4 = 3.75), then the addition — final value 14.75, a float throughout.

Two concepts combine: precedence with parentheses (brackets first, then / before +) and mixed-type arithmetic — whenever an int meets a float, the int is converted and the result is a float.

>>> 15.0 / 4 + (8 + 3.0)
14.75

Evaluation trace:

StepWhat Python doesExpression becomesType note
1Parentheses first: 8 + 3.015.0 / 4 + 11.0int + float → float 11.0
2/ has higher precedence than +: 15.0 / 43.75 + 11.0float / int → float 3.75
3The addition14.75float

Worth noticing:

  • 15.0 / 4 gives 3.75 — and in Python 3 even 15 / 4 (two ints) would give 3.75, because / is true division. Only // floors. …

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.