ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(3 ** -2 * 9, (3 ** -2) * 9 == 1.0, 3 ** -2 * 9 == 1)
  1. A. 1.0 False False
  2. B. 0.1111111111111111 True True
  3. C. 1.0 True True
  4. D. 2.0 True True

Correct answer: C. 1.0 True True

3 ** -2 is the float 0.1111..., and multiplying by 9 rounds back to exactly 1.0 here. Comparing with the int 1 is also True because 1.0 equals 1.

More Python Programming questions

Exams that ask this topic