ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(min([3, 1.0, True]), max([1, True, 1.0]), max([True, 1.0]), min([1.0, True]))
- A. 1 1 True 1.0
- B. 1.0 1 1 1.0
- C. 1.0 1 True 1
- D. 1.0 1 True 1.0
Correct answer: D. 1.0 1 True 1.0
True, 1 and 1.0 compare equal, and min and max return the first element that wins a tie. So max([1, True, 1.0]) is the first 1, and min([1.0, True]) keeps 1.0.
More Python Programming questions
- What is printed? python print(list(range(10, 0, -3)), range(0, 10, 3)[-1], len(range(5, 1)), range(3) == range(0, 3, 1), range(0, 6, 2) ==…
- What is printed? python print(sum(range(106)) == 106 (106 - 1) // 2, 20.5 20.5 == 2.0, 20.5 20.5)
- What is printed? python print(int(2.9999999999999996), float('1e400'), -float('1e400'), 1e308 10 == float('inf'))
- What is printed? python print(10 % 3.5, -10 % 3.5, 10 // 3.5, round(-1.5), round(0.5) + round(1.5))
- What is printed? python print(divmod(7.5, 2), 7.5 % -2, -7.5 // 2)
- What is printed? python print(f'{0.1:.20f}'[:12], f'{2/3:.3f}', f'{1e22:.0f}', f'{1e23:.0f}')