ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
print(float('1e2') == 100, int(float('1e2')), str(float('1e2')), int('100'))
  1. A. True 100 100 100
  2. B. False 100 100.0 100
  3. C. True 100 100.0 100
  4. D. True 100 100.0 10

Correct answer: C. True 100 100.0 100

1e2 is the float 100.0, which equals the int 100, and int() of it gives 100. str() of a float keeps the decimal point.

More Python Programming questions

Exams that ask this topic