Question DSA-QUE-0063
HardWhat is the output of this code?
import heapq
tasks = [(3, "c"), (1, "a"), (2, "b"), (1, "d")]
heapq.heapify(tasks)
print([heapq.heappop(tasks)[1] for _ in range(4)])
- A.
['c', 'b', 'a', 'd']
- B.
['a', 'b', 'c', 'd']
- C.
Sign up free to see the answer and a step-by-step explanation.