Write a function called subdict(d, keep=None, drop=None) that returns a filtered copy of the dictionary d…
Write a function called subdict(d, keep=None, drop=None) that returns a filtered copy of the dictionary d…: a task in repo2rlenv-r2e (Harbor dataset). Behavior: - The return type must be the same dict subclass as d (i.e. type(d) ). - If keep is None , all keys in d are initially considered…
The task
Behavior: - The return type must be the same dict subclass as `d` (i.e. `type(d)`). - If `keep` is `None`, all keys in `d` are initially considered candidates. - If `keep` is provided (any iterable), only keys present in both `d` and `keep` are candidates. - If `drop` is `None` or an empty iterable, no keys are…
Part of FineEnvs/repo2rlenv-r2e.