ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(3 ** -1, 7 // 0.5, 2 ** 0.5 * 2 ** 0.5 == 2)
  1. A. 0.3 14.0 False
  2. B. 0.3333333333333333 3.5 False
  3. C. 0.3333333333333333 14.0 False
  4. D. 0.3333333333333333 14 True

Correct answer: C. 0.3333333333333333 14.0 False

A negative int exponent gives a float, 1/3. 7 // 0.5 is 14.0. The square root of 2 squared is 2.0000000000000004 in floating point.

More Python Programming questions

Exams that ask this topic