ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(sum(int(c) for c in str(2**1000)), len(str(2**1000)))
  1. A. 1366 301
  2. B. 1365 302
  3. C. 1366 302
  4. D. 1368 302

Correct answer: C. 1366 302

2 to the power 1000 has 302 digits, and the digit sum of this number is 1366. Python integers keep every digit, so the conversion to str is exact.

More Python Programming questions

Exams that ask this topic