instance attributes
tasks = set()
def get_task():
global tasks
...
tasks.add((..., ...))
We need a global if we wish to assign tasks = set( ... )
in a way that code outside the function can see it.
Else we would assignbe assigning to a local named tasks,
which disappears when we return.
Simply omit that global declaration,
as the tasks.add() reference will
properly locate that symbol in the
top-level module namespace,
and then we mutate the existing object.
OOP
But a bigger issue is, maybe we would rather
define a class, and then talk about
the self.tasks attribute.
Whenever you're tempted to write global,
consider whether an object would be a better
place to keep track of invariant properties,
to keep track of what you want to be true in your app.
command line args
The while True: loop seems needlessly interactive.
Consider parsing sys.argv to obtain the required inputs.
Or let typer
sweat the details for you.
And you'll get some nice --help output "for free".