ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(len(str(10**50 + 1).rstrip('0')), str(10**50 + 1)[-2:], str(10**50 - 1)[:3])
  1. A. 50 01 999
  2. B. 51 10 999
  3. C. 51 01 999
  4. D. 51 01 100

Correct answer: C. 51 01 999

10**50 + 1 ends in 1, so rstrip removes nothing and the length stays 51. Its last two digits are 01, and 10**50 - 1 is all nines starting with 999.

More Python Programming questions

Exams that ask this topic