ProgrammingModerateTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(all([]), any([]), all(x > 0 for x in [1, 0]))
- A. True True False
- B. True False True
- C. True False False
- D. False False False
Correct answer: C. True False False
all of an empty iterable is True and any of it is False. all fails on the 0 in the list, so it is False.
More Python Programming questions
- What is printed? python print(list(map(lambda x, y: x y, [1, 2, 3], [4, 5])))
- What is printed? python print(sum([[1], [2, 3]], []), sum([[1], [2]], [0]) if False else 'skip')
- What is printed? python print(''.join(sorted(set('hello'), key=ord)))
- What is printed? python print(len({0.0, -0.0, 1}), hash(1) == hash(1.0) == hash(True))
- What is printed? python print(1 == 1.0 == True, {1: 'a'}.get(True))
- What is printed? python print([i j for i, j in zip(range(3), range(3, 0, -1))])