conversations
listlengths
2
2
source
stringclasses
8 values
[ { "role": "user", "content": "Create a utility function named `word_count` which 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 s...
dict_collections
[ { "role": "user", "content": "Create a utility function named `word_count` which 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": "Add a function `word_count` that 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": "Generate a Python function `word_count` for 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...
dict_collections
[ { "role": "user", "content": "Create a utility function named `word_count` which 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\")\...
dict_collections
[ { "role": "user", "content": "Write `word_count` in Python. It should 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 ...
dict_collections
[ { "role": "user", "content": "Make a function `word_count` to count word frequencies in text. Return sensible defaults for edge cases." }, { "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": "Provide a Python solution for `word_count`: 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 wor...
dict_collections
[ { "role": "user", "content": "Build a function `word_count` that count word frequencies in text, with edge-case handling. 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 st...
dict_collections
[ { "role": "user", "content": "Make a function `word_count` to 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 = te...
dict_collections
[ { "role": "user", "content": "Implement the function `word_count` (a string text) -> 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 ...
dict_collections
[ { "role": "user", "content": "Generate a Python function `word_count` for 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 ...
dict_collections
[ { "role": "user", "content": "Please provide `word_count` that 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 resul...
dict_collections
[ { "role": "user", "content": "Implement `word_count(a string text)` to count word frequencies in text. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str...
dict_collections
[ { "role": "user", "content": "Create `word_count(a string text)` returning a word-count dict. 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.lo...
dict_collections
[ { "role": "user", "content": "Write `word_count` in Python. It should 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 wo...
dict_collections
[ { "role": "user", "content": "Generate a Python function `word_count` for count word frequencies in text. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be ...
dict_collections
[ { "role": "user", "content": "Define a function `word_count` taking a string text and returning a word-count dict. Keep it efficient." }, { "role": "assistant", "content": "def word_count(text: str) -> dict:\n if not isinstance(text, str):\n raise TypeError(\"text must be str\")\n w...
dict_collections
[ { "role": "user", "content": "Code a function `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...
dict_collections
[ { "role": "user", "content": "Develop `word_count` such that it 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": "Develop `word_count` such that it 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 words = text...
dict_collections
[ { "role": "user", "content": "Develop `group_by` such that it group items by a key function or field. Include basic type checks." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\...
dict_collections
[ { "role": "user", "content": "Write `group_by` handling edge cases; it should group items by a key function or field. Use only the standard library." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"item...
dict_collections
[ { "role": "user", "content": "Build a function `group_by` that group items by a key function or field, with edge-case handling. Handle empty input gracefully." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeEr...
dict_collections
[ { "role": "user", "content": "Help me write `group_by` that group items by a key function or field. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must b...
dict_collections
[ { "role": "user", "content": "Write code for `group_by` (a list items and key) that group items by a key function or field. Add a brief docstring." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items ...
dict_collections
[ { "role": "user", "content": "Generate a Python function `group_by` for group items by a key function or field. Include basic type checks." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be ...
dict_collections
[ { "role": "user", "content": "Generate a Python function `group_by` for group items by a key function or field. Avoid mutating the input." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a...
dict_collections
[ { "role": "user", "content": "Help me write `group_by` that group items by a key function or field. Include basic type checks." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ...
dict_collections
[ { "role": "user", "content": "Implement the function `group_by` (a list items and key) -> a grouped dict. Include basic type checks." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list...
dict_collections
[ { "role": "user", "content": "Please provide `group_by` that group items by a key function or field. Use only the standard library." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\...
dict_collections
[ { "role": "user", "content": "Provide a Python solution for `group_by`: group items by a key function or field. Make it robust to invalid input." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items mu...
dict_collections
[ { "role": "user", "content": "Draft a Python function `group_by` to group items by a key function or field. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"item...
dict_collections
[ { "role": "user", "content": "Add a function `group_by` that group items by a key function or field. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must ...
dict_collections
[ { "role": "user", "content": "Produce a clean implementation of `group_by`: group items by a key function or field. Handle empty input gracefully." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items ...
dict_collections
[ { "role": "user", "content": "Create a robust `group_by` that group items by a key function or field. " }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n result = {}\n for ...
dict_collections
[ { "role": "user", "content": "Implement `group_by`. It should group items by a key function or field. Include basic type checks." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\...
dict_collections
[ { "role": "user", "content": "Implement `group_by(a list items and key)` to group items by a key function or field. Use only the standard library." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items ...
dict_collections
[ { "role": "user", "content": "Write a Python function `group_by` that group items by a key function or field. Avoid mutating the input." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a l...
dict_collections
[ { "role": "user", "content": "Create a robust `group_by` that group items by a key function or field. Use only the standard library." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list...
dict_collections
[ { "role": "user", "content": "Write code for `group_by` (a list items and key) that group items by a key function or field. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise ...
dict_collections
[ { "role": "user", "content": "Implement `group_by` with proper validation: group items by a key function or field. " }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n result =...
dict_collections
[ { "role": "user", "content": "Please provide `group_by` that group items by a key function or field. Make it robust to invalid input." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a lis...
dict_collections
[ { "role": "user", "content": "Write `group_by` handling edge cases; it should group items by a key function or field. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeEr...
dict_collections
[ { "role": "user", "content": "Code a function `group_by` to group items by a key function or field. Keep it efficient." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n resul...
dict_collections
[ { "role": "user", "content": "Implement `group_by`. It should group items by a key function or field. Make it robust to invalid input." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a li...
dict_collections
[ { "role": "user", "content": "Develop `group_by` such that it group items by a key function or field. " }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n result = {}\n for ...
dict_collections
[ { "role": "user", "content": "Implement `group_by(a list items and key)` to group items by a key function or field. Include basic type checks." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must...
dict_collections
[ { "role": "user", "content": "Help me write `group_by` that group items by a key function or field. Keep it efficient." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n resul...
dict_collections
[ { "role": "user", "content": "Implement the function `group_by` (a list items and key) -> a grouped dict. Handle empty input gracefully." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a ...
dict_collections
[ { "role": "user", "content": "Create a utility function named `group_by` which group items by a key function or field. Handle empty input gracefully." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"ite...
dict_collections
[ { "role": "user", "content": "Code a function `group_by` to group items by a key function or field. Avoid mutating the input." }, { "role": "assistant", "content": "def group_by(items: list, key) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ...
dict_collections
[ { "role": "user", "content": "Generate a Python function `frequency_map` for build a frequency map of list elements. Handle empty input gracefully." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items...
dict_collections
[ { "role": "user", "content": "Make a function `frequency_map` to build a frequency map of list elements. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items m...
dict_collections
[ { "role": "user", "content": "Add a function `frequency_map` that build a frequency map of list elements. Include basic type checks." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list...
dict_collections
[ { "role": "user", "content": "Create a robust `frequency_map` that build a frequency map of list elements. Avoid mutating the input." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list...
dict_collections
[ { "role": "user", "content": "Develop `frequency_map` such that it build a frequency map of list elements. Include basic type checks." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a lis...
dict_collections
[ { "role": "user", "content": "Generate a Python function `frequency_map` for build a frequency map of list elements. " }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n result...
dict_collections
[ { "role": "user", "content": "Create a robust `frequency_map` that build a frequency map of list elements. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items...
dict_collections
[ { "role": "user", "content": "Create a robust `frequency_map` that build a frequency map of list elements. Include basic type checks." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a lis...
dict_collections
[ { "role": "user", "content": "Create `frequency_map(a list items)` returning a frequency dict. Avoid mutating the input." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n res...
dict_collections
[ { "role": "user", "content": "Build a function `frequency_map` that build a frequency map of list elements, with edge-case handling. Add a brief docstring." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError...
dict_collections
[ { "role": "user", "content": "Please provide `frequency_map` that build a frequency map of list elements. Use only the standard library." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a ...
dict_collections
[ { "role": "user", "content": "Help me write `frequency_map` that build a frequency map of list elements. Keep it efficient." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ...
dict_collections
[ { "role": "user", "content": "Write a reusable function `frequency_map` which build a frequency map of list elements. Avoid mutating the input." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items mus...
dict_collections
[ { "role": "user", "content": "Implement `frequency_map(a list items)` to build a frequency map of list elements. " }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n result = {...
dict_collections
[ { "role": "user", "content": "Provide a Python solution for `frequency_map`: build a frequency map of list elements. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeErr...
dict_collections
[ { "role": "user", "content": "Formulate `frequency_map` to build a frequency map of list elements. Use only the standard library." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")...
dict_collections
[ { "role": "user", "content": "Help me write `frequency_map` that build a frequency map of list elements. Include basic type checks." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\...
dict_collections
[ { "role": "user", "content": "Provide a Python solution for `frequency_map`: build a frequency map of list elements. Add a brief docstring." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be...
dict_collections
[ { "role": "user", "content": "Write a Python function `frequency_map` that build a frequency map of list elements. Make it robust to invalid input." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items...
dict_collections
[ { "role": "user", "content": "Make a function `frequency_map` to build a frequency map of list elements. Add a brief docstring." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n...
dict_collections
[ { "role": "user", "content": "Write `frequency_map` handling edge cases; it should build a frequency map of list elements. Use only the standard library." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\...
dict_collections
[ { "role": "user", "content": "Implement `frequency_map` with proper validation: build a frequency map of list elements. Avoid mutating the input." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items m...
dict_collections
[ { "role": "user", "content": "Write `frequency_map` handling edge cases; it should build a frequency map of list elements. Keep it efficient." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must ...
dict_collections
[ { "role": "user", "content": "Develop `frequency_map` such that it build a frequency map of list elements. Make it robust to invalid input." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be...
dict_collections
[ { "role": "user", "content": "Create a robust `frequency_map` that build a frequency map of list elements. Keep it efficient." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ...
dict_collections
[ { "role": "user", "content": "Add a function `frequency_map` that build a frequency map of list elements. Avoid mutating the input." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\...
dict_collections
[ { "role": "user", "content": "Construct `frequency_map` to build a frequency map of list elements. Handle empty input gracefully." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")...
dict_collections
[ { "role": "user", "content": "Generate a Python function `frequency_map` for build a frequency map of list elements. Keep it efficient." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a l...
dict_collections
[ { "role": "user", "content": "Code a function `frequency_map` to build a frequency map of list elements. Use only the standard library." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a l...
dict_collections
[ { "role": "user", "content": "Construct `frequency_map` to build a frequency map of list elements. Add a brief docstring." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n re...
dict_collections
[ { "role": "user", "content": "Create a robust `frequency_map` that build a frequency map of list elements. Add a brief docstring." }, { "role": "assistant", "content": "def frequency_map(items: list) -> dict:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")...
dict_collections
[ { "role": "user", "content": "Write a Python function `sort_dict_by_value` that sort a dict by its values. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n rai...
dict_collections
[ { "role": "user", "content": "Draft a Python function `sort_dict_by_value` to sort a dict by its values. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise...
dict_collections
[ { "role": "user", "content": "Make a function `sort_dict_by_value` to sort a dict by its values. Avoid mutating the input." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be ...
dict_collections
[ { "role": "user", "content": "Create a robust `sort_dict_by_value` that sort a dict by its values. " }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return d...
dict_collections
[ { "role": "user", "content": "Develop `sort_dict_by_value` such that it sort a dict by its values. Use only the standard library." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d m...
dict_collections
[ { "role": "user", "content": "Implement `sort_dict_by_value` with proper validation: sort a dict by its values. Avoid mutating the input." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeErr...
dict_collections
[ { "role": "user", "content": "Construct `sort_dict_by_value` to sort a dict by its values. Add a brief docstring." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")...
dict_collections
[ { "role": "user", "content": "Provide a Python solution for `sort_dict_by_value`: sort a dict by its values. Use only the standard library." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeE...
dict_collections
[ { "role": "user", "content": "Implement `sort_dict_by_value(a dict d)` to sort a dict by its values. Avoid mutating the input." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must...
dict_collections
[ { "role": "user", "content": "Write a reusable function `sort_dict_by_value` which sort a dict by its values. Keep it efficient." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d mu...
dict_collections
[ { "role": "user", "content": "Implement the function `sort_dict_by_value` (a dict d) -> a sorted dict. Include basic type checks." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d m...
dict_collections
[ { "role": "user", "content": "Construct `sort_dict_by_value` to sort a dict by its values. Make it robust to invalid input." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be...
dict_collections
[ { "role": "user", "content": "Write `sort_dict_by_value` handling edge cases; it should sort a dict by its values. Make it robust to invalid input." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n rai...
dict_collections
[ { "role": "user", "content": "Provide a Python solution for `sort_dict_by_value`: sort a dict by its values. Include basic type checks." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError...
dict_collections
[ { "role": "user", "content": "Create `sort_dict_by_value(a dict d)` returning a sorted dict. Handle empty input gracefully." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be...
dict_collections
[ { "role": "user", "content": "Build a function `sort_dict_by_value` that sort a dict by its values, with edge-case handling. Add a brief docstring." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n rai...
dict_collections
[ { "role": "user", "content": "Create a utility function named `sort_dict_by_value` which sort a dict by its values. Include basic type checks." }, { "role": "assistant", "content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise Ty...
dict_collections