ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(max(map(int, '3 17 9'.split())), min(map(int, '3 17 9'.split())), sorted('3 17 9'.split())[-1])- A. 17 3 17
- B. 9 3 9
- C. 17 3 9
- D. 17 3 3
Correct answer: C. 17 3 9
Converted to numbers, 17 is the largest and 3 the smallest. Sorted as strings, '17' comes before '3' and '9', so the last string is '9'.
More Python Programming questions
- What is printed? python print(sorted(['1.10', '1.9', '1.10.1'], key=lambda v: tuple(map(int, v.split('.')))))
- What is printed? python print(sorted(['1.10', '1.9', '1.10.1']))
- What is printed? python values = [2.0, 2, '2'] print(len(set(values[:2])), len(set(values)), values[0] == values[1] == 2)
- What is printed? python t = 3 print(t // 2 if t % 2 else t / 2, 1 if t else 0, t and 0, t or 0, not t)
- What is printed? python print(int(0.999999999999999999999), round(0.4999999999999999), round(-0.4999999999999999), int(-0.9))
- What is printed? python print(f'{12.0:g}', f'{12.5:g}', f'{0.00001234:g}', f'{123456789:g}', f'{1.5e300:g}')