What will the following expression be evaluated to in Python?
print(15.0 / 4 + (8 + 3.0))
(a) 14.75
(b)14.0
(c) 15
(d) 15.5
Answer:
So, the correct answer is (a) 14.75
Explanation:
Step 1: In python, the content inside the parentheses is evaluated first. So the expression becomes (15.0 / 4 + (11.0))
Step 2: ‘/’ takes precedence over ‘+’. So the expression becomes (3.75 + 11.0)
Step 3: The final evaluation is done and the answer is 14.75