ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
print(len(str(9 ** 20)), str(9 ** 20)[0], sum(map(int, str(9 ** 20))) % 9)
  1. A. 20 1 0
  2. B. 21 1 0
  3. C. 20 9 0
  4. D. 20 1 9

Correct answer: A. 20 1 0

9**20 has 20 digits, starting with 1. A number and its digit sum agree mod 9, and 9**20 is divisible by 9, so the last value is 0.

More Python Programming questions

Exams that ask this topic