ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(sum(int(d) for d in str(3**20)) % 9, 3**20 % 9, (3**20) % 10)
  1. A. 0 0 9
  2. B. 0 0 1
  3. C. 1 0 1
  4. D. 0 1 1

Correct answer: B. 0 0 1

A number and its digit sum agree modulo 9, and 3 to the power 20 is divisible by 9, so both remainders are 0. The last digit of 3**20 is 1.

More Python Programming questions

Exams that ask this topic