ProgrammingHardTCS NQT · Accenture

What is printed?

What is printed?
print(len(str(2**1000)), sum(map(int, str(2**1000))))
  1. A. 301 1366
  2. B. 302 1364
  3. C. 302 1366
  4. D. 303 1366

Correct answer: C. 302 1366

2**1000 has 302 decimal digits, since 10**301 is the smallest 302-digit number and 2**1000 is about 1.07e301. Its digit sum is 1366, a standard check value.

More Python Programming questions

Exams that ask this topic