CBSE Class 12 Computer Science Question 90 of 105

Python Revision Tour — Question 16

Back to all questions
16
Question

Question 3

Which of the following is the correct output for the execution of the following Python statement ?

print(5 + 3 ** 2 / 2)
  1. 32
  2. 8.0
  3. 9.5
  4. 32.0
Answer

9.5

Explanation

According to operator precedence, exponentiation(**) will come first then division then addition.

5 + 3 ** 2 / 2
= 5 + 9 / 2
= 5 + 4.5
= 9.5