ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(int(float('1e3')), int('12'))
  1. A. 1000 Error
  2. B. 1e3 12
  3. C. 1000 ValueError
  4. D. 1000 12

Correct answer: D. 1000 12

float('1e3') is 1000.0 and int of that is 1000. int() accepts any Unicode decimal digits, so the full-width digits U+FF11 and U+FF12 read as 12.

More Python Programming questions

Exams that ask this topic