Write a Python function called flip that swaps the keys and values of a mapping or collection of pairs.
Write a Python function called flip that swaps the keys and values of a mapping or collection of pairs.: a task in repo2rlenv-r2e (Harbor dataset). The function takes a single argument mapping , which can be: - A dict mapping hashable keys to hashable values. - A list of (key, value) 2-tuples. - A…
The task
The function takes a single argument `mapping`, which can be: - A `dict` mapping hashable keys to hashable values. - A `list` of `(key, value)` 2-tuples. - A `tuple` of `(key, value)` 2-tuples.
Part of FineEnvs/repo2rlenv-r2e.