ProgrammingModerateTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(max(range(10), key=lambda x: x % 4), min([], default=7))
- A. 9 7
- B. 3 7
- C. 7 7
- D. 3 0
Correct answer: B. 3 7
The largest remainder mod 4 is 3, reached first at x = 3. min of an empty iterable returns the default 7.
More Python Programming questions
- What is printed? python print(3 -1, 7 // 0.5, 2 0.5 2 0.5 == 2)
- What is printed? python print(float('%.2f' % 0.125), '%.3e' % 12345.678)
- What is printed? python print(int(str(2 70)[:5]), len(str(2 70)))
- What is printed? python print(list(range(10, 0, -4)), [sum(r) for r in [(1, 2), (3,)]])
- What is printed? python print(2 0.5 2 0.5, 2 0.5 2 0.5 == 2.0, round(2 0.5 2 0.5))
- What is printed? python print(min(map(str, [10, 9, 100])), sorted(['10', '9', '100']), sorted([10, 9, 100]))