ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(max('7', '10'), max(7, 10), min('7', '10'), '7' > '10')- A. 10 10 7 False
- B. 7 10 10 True
- C. 7 10 7 True
- D. 7 10 10 False
Correct answer: B. 7 10 10 True
Strings compare character by character, so '7' is greater than '10'. As ints, 10 is larger, and min of the strings is '10'.
More Python Programming questions
- What is printed? python print(len(f'{3.5:>8.2f}'), f'{-3.5:08.1f}', f'{12:#06x}', f'{7:+05d}')
- What is printed? python print('abc'.encode() == b'abc', b'abc'.decode() == 'abc', 'é'.encode('utf-8') == b'xc3xa9', len(b'xc3xa9'.decode()))
- What is printed? python print('%.3s' % 'abcdef' + '|' + '%-4d|' % 7 + '%04.1f' % 2.25)
- What is printed? python x = 0xFF print(x >> 4, x & 0xF0, x ^ 0x0F, ~x & 0xFF)
- What is printed? python print(int.frombytes((65).tobytes(1, 'big') 3, 'big'), 65 65 65, bytes([65] 3).decode())
- What is printed? python print(max(['10', '9'], key=len), max(['10', '9']), max([10, 9], key=str))