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)
- A. 20 1 0
- B. 21 1 0
- C. 20 9 0
- 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
- What is printed? python from fractions import Fraction print(Fraction('1.5'), Fraction('3/6'), float(Fraction('1/3')) == 1/3…
- What is printed? python print(sum([[1, 2], [3]], []), ''.join(['ab', 'c']), [x for x in 'hey'][::2])
- What is printed? python print('%o' % 8 == oct(8)[2:], '%x' % 255 == hex(255)[2:], bin(5)[2:].zfill(4))
- What is printed? python print(-1 2, (-1) 2, -1 -1, (-1) -1)
- What is printed? python print(divmod(-9, 4), divmod(9, -4), -9 % 4, 9 % -4)
- What is printed? python class C: k = 10 try: a = [k + x for x in range(3)] except NameError: a = 'NameError' print(C.a)