ProgrammingHardTCS NQT · Wipro pattern

What is printed?

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

Correct answer: C. True True int float

10 ** 3 is an int and 1e3 is a float, and the two are equal in value. The type names show the difference between the two results.

More Python Programming questions

Exams that ask this topic