ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(10**100 // 10**98, (10**100) % 97 == pow(10, 100, 97))
- A. 100 False
- B. 100 True
- C. 10 True
- D. 98 True
Correct answer: B. 100 True
10**100 // 10**98 is exactly 100. pow with a modulus agrees with the % of the full exact integer, so the comparison is True.
More Python Programming questions
- What is printed? python print(sorted(['b10', 'b9', 'a10'], key=lambda s: (s[0], int(s[1:]))))
- What is printed? python print(sorted('bAcB', key=str.upper), sorted('bAcB'))
- What is printed? python print(int('0' + '9' 3) + 1, int('9' 3 + '0') + 1)
- What is printed? python print(7 // 0.5, 7 % 0.5, -7 // 0.5)
- What is printed? python print(0.5 1074 == 0, 5e-324 > 0, 5e-324 / 2 == 0)
- What is printed? python print('abcabc'.replace('abc', 'x', 1), 'aaaa'.replace('aa', 'b'), 'aaa'.replace('', '-'))