Files
2026-03-26 17:03:42 +02:00

13 lines
230 B
Python

import heapq
class Tasks:
def __init__(self):
self.t = []
def add_task(self, name, priority):
heapq.heappush(self.t, (-priority, name))
def fetch_task(self):
return heapq.heappop(self.t)[1]