conversations listlengths 2 2 | source stringclasses 8
values |
|---|---|
[
{
"role": "user",
"content": "Help me write `reverse_list` that reverse a list. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[:... | list_ops |
[
{
"role": "user",
"content": "Create `reverse_list(a list items)` returning the reversed list. Use only the standard library."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ... | list_ops |
[
{
"role": "user",
"content": "Write `reverse_list` in Python. It should reverse a list. Use only the standard library."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return... | list_ops |
[
{
"role": "user",
"content": "Can you write code for `reverse_list` that reverse a list? Keep it efficient."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[::-1... | list_ops |
[
{
"role": "user",
"content": "Implement `reverse_list(a list items)` to reverse a list. "
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[::-1]\n"
}
] | list_ops |
[
{
"role": "user",
"content": "Implement the function `reverse_list` (a list items) -> the reversed list. Include basic type checks."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\"... | list_ops |
[
{
"role": "user",
"content": "Construct `reverse_list` to reverse a list. Add a brief docstring."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[::-1]\n"
}
] | list_ops |
[
{
"role": "user",
"content": "I need a Python helper `reverse_list` that reverse a list. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n retur... | list_ops |
[
{
"role": "user",
"content": "Implement the function `reverse_list` (a list items) -> the reversed list. Use only the standard library."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a li... | list_ops |
[
{
"role": "user",
"content": "Draft a Python function `reverse_list` to reverse a list. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n retu... | list_ops |
[
{
"role": "user",
"content": "Draft a Python function `reverse_list` to reverse a list. Keep it efficient."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[::-1]... | list_ops |
[
{
"role": "user",
"content": "Produce a clean implementation of `reverse_list`: reverse a list. Use only the standard library."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ... | list_ops |
[
{
"role": "user",
"content": "Make a function `reverse_list` to reverse a list. Include basic type checks."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[::-1]... | list_ops |
[
{
"role": "user",
"content": "Define a function `reverse_list` taking a list items and returning the reversed list. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items... | list_ops |
[
{
"role": "user",
"content": "Implement `reverse_list` returning the reversed list given a list items. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a li... | list_ops |
[
{
"role": "user",
"content": "Write code for `reverse_list` (a list items) that reverse a list. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ... | list_ops |
[
{
"role": "user",
"content": "Write a reusable function `reverse_list` which reverse a list. Add a brief docstring."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return it... | list_ops |
[
{
"role": "user",
"content": "Add a function `reverse_list` that reverse a list. Use only the standard library."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[... | list_ops |
[
{
"role": "user",
"content": "Write a reusable function `reverse_list` which reverse a list. Use only the standard library."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n r... | list_ops |
[
{
"role": "user",
"content": "Develop `reverse_list` such that it reverse a list. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return ite... | list_ops |
[
{
"role": "user",
"content": "Create a utility function named `reverse_list` which reverse a list. "
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[::-1]\n"
}... | list_ops |
[
{
"role": "user",
"content": "Build a function `reverse_list` that reverse a list, with edge-case handling. Add a brief docstring."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")... | list_ops |
[
{
"role": "user",
"content": "Can you write code for `reverse_list` that reverse a list? Include basic type checks."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return it... | list_ops |
[
{
"role": "user",
"content": "Implement `reverse_list(a list items)` to reverse a list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return item... | list_ops |
[
{
"role": "user",
"content": "Help me write `reverse_list` that reverse a list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def reverse_list(items: list) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n return items[::-1]\... | list_ops |
[
{
"role": "user",
"content": "Please provide `merge_dicts` that merge two dictionaries. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"input... | dict_collections |
[
{
"role": "user",
"content": "Develop `merge_dicts` such that it merge two dictionaries. "
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs must be dicts\")\n resul... | dict_collections |
[
{
"role": "user",
"content": "Write code for `merge_dicts` (dicts d1 and d2) that merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise Typ... | dict_collections |
[
{
"role": "user",
"content": "Add a function `merge_dicts` that merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs mu... | dict_collections |
[
{
"role": "user",
"content": "Implement `merge_dicts` with proper validation: merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeErr... | dict_collections |
[
{
"role": "user",
"content": "Implement `merge_dicts`. It should merge two dictionaries. Use only the standard library."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inpu... | dict_collections |
[
{
"role": "user",
"content": "Write `merge_dicts` in Python. It should merge two dictionaries. Keep it efficient."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs mus... | dict_collections |
[
{
"role": "user",
"content": "Code a function `merge_dicts` to merge two dictionaries. Use only the standard library."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs... | dict_collections |
[
{
"role": "user",
"content": "Create a robust `merge_dicts` that merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs m... | dict_collections |
[
{
"role": "user",
"content": "Construct `merge_dicts` to merge two dictionaries. Keep it efficient."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs must be dicts\")\... | dict_collections |
[
{
"role": "user",
"content": "Construct `merge_dicts` to merge two dictionaries. Add a brief docstring."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs must be dicts... | dict_collections |
[
{
"role": "user",
"content": "Implement `merge_dicts`. It should merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs m... | dict_collections |
[
{
"role": "user",
"content": "Write `merge_dicts` handling edge cases; it should merge two dictionaries. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeE... | dict_collections |
[
{
"role": "user",
"content": "Implement `merge_dicts`. It should merge two dictionaries. Keep it efficient."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs must be d... | dict_collections |
[
{
"role": "user",
"content": "I need a Python helper `merge_dicts` that merge two dictionaries. Add a brief docstring."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"input... | dict_collections |
[
{
"role": "user",
"content": "Create a utility function named `merge_dicts` which merge two dictionaries. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise... | dict_collections |
[
{
"role": "user",
"content": "Implement `merge_dicts` returning a merged dict given dicts d1 and d2. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise Ty... | dict_collections |
[
{
"role": "user",
"content": "Write a reusable function `merge_dicts` which merge two dictionaries. Use only the standard library."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeE... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `merge_dicts` (dicts d1 and d2) -> a merged dict. Add a brief docstring."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `merge_dicts` (dicts d1 and d2) -> a merged dict. "
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs must be dicts... | dict_collections |
[
{
"role": "user",
"content": "Write a Python function `merge_dicts` that merge two dictionaries. Use only the standard library."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeErro... | dict_collections |
[
{
"role": "user",
"content": "Formulate `merge_dicts` to merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs must be d... | dict_collections |
[
{
"role": "user",
"content": "Generate a Python function `merge_dicts` for merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(... | dict_collections |
[
{
"role": "user",
"content": "Write `merge_dicts`: merge two dictionaries. Keep it efficient."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs must be dicts\")\n r... | dict_collections |
[
{
"role": "user",
"content": "Construct `merge_dicts` to merge two dictionaries. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"in... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `merge_dicts`: merge two dictionaries. "
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"inputs must be dicts\")\... | dict_collections |
[
{
"role": "user",
"content": "Define a function `merge_dicts` taking dicts d1 and d2 and returning a merged dict. Use only the standard library."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n ... | dict_collections |
[
{
"role": "user",
"content": "Build a function `merge_dicts` that merge two dictionaries, with edge-case handling. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dic... | dict_collections |
[
{
"role": "user",
"content": "Write `merge_dicts` in Python. It should merge two dictionaries. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeErro... | dict_collections |
[
{
"role": "user",
"content": "Write code for `merge_dicts` (dicts d1 and d2) that merge two dictionaries. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise Type... | dict_collections |
[
{
"role": "user",
"content": "Implement `merge_dicts` returning a merged dict given dicts d1 and d2. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError... | dict_collections |
[
{
"role": "user",
"content": "I need a Python helper `merge_dicts` that merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def merge_dicts(d1: dict, d2: dict) -> dict:\n if not (isinstance(d1, dict) and isinstance(d2, dict)):\n raise TypeError(\"i... | dict_collections |
[
{
"role": "user",
"content": "Write `invert_dict`: invert keys and values. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v ... | dict_collections |
[
{
"role": "user",
"content": "Add a function `invert_dict` that invert keys and values. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in... | dict_collections |
[
{
"role": "user",
"content": "Help me write `invert_dict` that invert keys and values. Keep it efficient."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d.items... | dict_collections |
[
{
"role": "user",
"content": "Define a function `invert_dict` taking a dict d and returning an inverted dict. Keep it efficient."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v... | dict_collections |
[
{
"role": "user",
"content": "Construct `invert_dict` to invert keys and values. Use only the standard library."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d... | dict_collections |
[
{
"role": "user",
"content": "Create `invert_dict(a dict d)` returning an inverted dict. Add a brief docstring."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d... | dict_collections |
[
{
"role": "user",
"content": "Implement `invert_dict` returning an inverted dict given a dict d. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {... | dict_collections |
[
{
"role": "user",
"content": "Generate a Python function `invert_dict` for invert keys and values. Keep it efficient."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, ... | dict_collections |
[
{
"role": "user",
"content": "Formulate `invert_dict` to invert keys and values. Add a brief docstring."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d.items()... | dict_collections |
[
{
"role": "user",
"content": "Implement `invert_dict(a dict d)` to invert keys and values. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k f... | dict_collections |
[
{
"role": "user",
"content": "Write a reusable function `invert_dict` which invert keys and values. "
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d.items()}\n... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `invert_dict`: invert keys and values. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return... | dict_collections |
[
{
"role": "user",
"content": "Help me write `invert_dict` that invert keys and values. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `invert_dict` (a dict d) -> an inverted dict. "
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d.items()}\n"... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `invert_dict`: invert keys and values. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n ... | dict_collections |
[
{
"role": "user",
"content": "Produce a clean implementation of `invert_dict`: invert keys and values. "
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d.items()... | dict_collections |
[
{
"role": "user",
"content": "Please provide `invert_dict` that invert keys and values. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v... | dict_collections |
[
{
"role": "user",
"content": "Write `invert_dict` in Python. It should invert keys and values. Use only the standard library."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `invert_dict`: invert keys and values. "
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d.items()}\n"... | dict_collections |
[
{
"role": "user",
"content": "Define a function `invert_dict` taking a dict d and returning an inverted dict. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n ... | dict_collections |
[
{
"role": "user",
"content": "Construct `invert_dict` to invert keys and values. "
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d.items()}\n"
}
] | dict_collections |
[
{
"role": "user",
"content": "Implement `invert_dict` returning an inverted dict given a dict d. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k fo... | dict_collections |
[
{
"role": "user",
"content": "Implement `invert_dict` with proper validation: invert keys and values. Include basic type checks."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v... | dict_collections |
[
{
"role": "user",
"content": "Create a robust `invert_dict` that invert keys and values. "
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d.items()}\n"
}
] | dict_collections |
[
{
"role": "user",
"content": "Please provide `invert_dict` that invert keys and values. Use only the standard library."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k,... | dict_collections |
[
{
"role": "user",
"content": "Develop `invert_dict` such that it invert keys and values. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {... | dict_collections |
[
{
"role": "user",
"content": "Define a function `invert_dict` taking a dict d and returning an inverted dict. Use only the standard library."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n ... | dict_collections |
[
{
"role": "user",
"content": "Implement `invert_dict`. It should invert keys and values. Add a brief docstring."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v in d... | dict_collections |
[
{
"role": "user",
"content": "Add a function `invert_dict` that invert keys and values. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k,... | dict_collections |
[
{
"role": "user",
"content": "I need a Python helper `invert_dict` that invert keys and values. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for... | dict_collections |
[
{
"role": "user",
"content": "Write a reusable function `invert_dict` which invert keys and values. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k... | dict_collections |
[
{
"role": "user",
"content": "Implement `invert_dict(a dict d)` to invert keys and values. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def invert_dict(d: dict) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {v: k for k, v... | dict_collections |
[
{
"role": "user",
"content": "Implement `word_count` with proper validation: count word frequencies in text. Include basic type checks."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n ... | dict_collections |
[
{
"role": "user",
"content": "Formulate `word_count` to count word frequencies in text. Add a brief docstring."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words = text.lower().spl... | dict_collections |
[
{
"role": "user",
"content": "Write a reusable function `word_count` which count word frequencies in text. "
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words = text.lower().split(... | dict_collections |
[
{
"role": "user",
"content": "Create `word_count(a string text)` returning a word-count dict. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words = ... | dict_collections |
[
{
"role": "user",
"content": "Develop `word_count` such that it count word frequencies in text. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words ... | dict_collections |
[
{
"role": "user",
"content": "Implement `word_count`. It should count word frequencies in text. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words = text.... | dict_collections |
[
{
"role": "user",
"content": "Code a function `word_count` to count word frequencies in text. "
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words = text.lower().split()\n result... | dict_collections |
[
{
"role": "user",
"content": "Write code for `word_count` (a string text) that count word frequencies in text. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n ... | dict_collections |
[
{
"role": "user",
"content": "Develop `word_count` such that it count word frequencies in text. Add a brief docstring."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words = text.low... | dict_collections |
[
{
"role": "user",
"content": "Write `word_count`: count word frequencies in text. Use only the standard library."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words = text.lower().s... | dict_collections |
[
{
"role": "user",
"content": "Please provide `word_count` that count word frequencies in text. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n words = t... | dict_collections |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.