ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(10 ** -2, 10 ** 2.0, 10 // 3.0)
  1. A. 0.01 100.0 3
  2. B. 0.01 100.0 3.0
  3. C. 0.01 100 3
  4. D. 0 100.0 3.0

Correct answer: B. 0.01 100.0 3.0

A negative int exponent gives a float, 0.01. Any float operand makes the result a float, so 10 ** 2.0 is 100.0 and 10 // 3.0 is 3.0.

More Python Programming questions

Exams that ask this topic