ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(1e3 == 10**3, int(1e3) is not None, 1e3 // 1 == 10**3, type(1e3 // 1).__name__)
  1. A. True True True int
  2. B. True True True float
  3. C. True False True float
  4. D. False True True float

Correct answer: B. True True True float

1e3 is a float with the exact value 1000.0, and floor division of floats returns a float. Comparing it with the int 1000 is True because the values are equal.

More Python Programming questions

Exams that ask this topic