ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(int('١٢٣'), int('0' * 2 + '5'), int('5' + '0' * 2), int(' \t7\n'))
  1. A. 123 5 50 7
  2. B. 123 0 500 7
  3. C. 12 5 500 7
  4. D. 123 5 500 7

Correct answer: D. 123 5 500 7

int() accepts Unicode decimal digits, so Arabic-Indic digits 1 2 3 give 123. Leading zeros are fine in a string passed to int(), and surrounding whitespace, including tabs and newlines, is stripped.

More Python Programming questions

Exams that ask this topic