conversations listlengths 2 2 | source stringclasses 8
values |
|---|---|
[
{
"role": "user",
"content": "Implement `combinations`. It should generate all r-combinations of a list. "
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n if r < 0:\n... | recursion |
[
{
"role": "user",
"content": "Make a function `combinations` to generate all r-combinations of a list. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must... | recursion |
[
{
"role": "user",
"content": "Formulate `combinations` to generate all r-combinations of a list. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a li... | recursion |
[
{
"role": "user",
"content": "Code a function `combinations` to generate all r-combinations of a list. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must... | recursion |
[
{
"role": "user",
"content": "Generate a Python function `combinations` for generate all r-combinations of a list. Include basic type checks."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"item... | recursion |
[
{
"role": "user",
"content": "I need a Python helper `combinations` that generate all r-combinations of a list. Use only the standard library."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"ite... | recursion |
[
{
"role": "user",
"content": "Write `combinations`: generate all r-combinations of a list. Include basic type checks."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ... | recursion |
[
{
"role": "user",
"content": "Implement `combinations` with proper validation: generate all r-combinations of a list. "
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\")\n ... | recursion |
[
{
"role": "user",
"content": "Write `combinations` in Python. It should generate all r-combinations of a list. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"it... | recursion |
[
{
"role": "user",
"content": "Write code for `combinations` (items and r) that generate all r-combinations of a list. Include basic type checks."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"i... | recursion |
[
{
"role": "user",
"content": "Develop `combinations` such that it generate all r-combinations of a list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a... | recursion |
[
{
"role": "user",
"content": "Create a utility function named `combinations` which generate all r-combinations of a list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(... | recursion |
[
{
"role": "user",
"content": "Implement `combinations`. It should generate all r-combinations of a list. Keep it efficient."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list\"... | recursion |
[
{
"role": "user",
"content": "Write code for `combinations` (items and r) that generate all r-combinations of a list. Keep it efficient."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items mus... | recursion |
[
{
"role": "user",
"content": "I need a Python helper `combinations` that generate all r-combinations of a list. Include basic type checks."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items m... | recursion |
[
{
"role": "user",
"content": "Formulate `combinations` to generate all r-combinations of a list. Use only the standard library."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a li... | recursion |
[
{
"role": "user",
"content": "Help me write `combinations` that generate all r-combinations of a list. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"it... | recursion |
[
{
"role": "user",
"content": "Can you write code for `combinations` that generate all r-combinations of a list? Include basic type checks."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items m... | recursion |
[
{
"role": "user",
"content": "Code a function `combinations` to generate all r-combinations of a list. Add a brief docstring."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items must be a list... | recursion |
[
{
"role": "user",
"content": "Please provide `combinations` that generate all r-combinations of a list. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"i... | recursion |
[
{
"role": "user",
"content": "Provide a Python solution for `combinations`: generate all r-combinations of a list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def combinations(items: list, r: int) -> list:\n if not isinstance(items, list):\n raise TypeError(\"items... | recursion |
[
{
"role": "user",
"content": "Write `factorial_recursive` handling edge cases; it should compute factorial recursively. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError... | recursion |
[
{
"role": "user",
"content": "Add a function `factorial_recursive` that compute factorial recursively. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < ... | recursion |
[
{
"role": "user",
"content": "Create a utility function named `factorial_recursive` which compute factorial recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n mu... | recursion |
[
{
"role": "user",
"content": "Implement `factorial_recursive` returning n factorial given an integer n. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int... | recursion |
[
{
"role": "user",
"content": "Build a function `factorial_recursive` that compute factorial recursively, with edge-case handling. "
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n ... | recursion |
[
{
"role": "user",
"content": "Add a function `factorial_recursive` that compute factorial recursively. Include basic type checks."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n <... | recursion |
[
{
"role": "user",
"content": "Implement the function `factorial_recursive` (an integer n) -> n factorial. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n ... | recursion |
[
{
"role": "user",
"content": "Provide a Python solution for `factorial_recursive`: compute factorial recursively. "
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ra... | recursion |
[
{
"role": "user",
"content": "Develop `factorial_recursive` such that it compute factorial recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:... | recursion |
[
{
"role": "user",
"content": "Provide a Python solution for `factorial_recursive`: compute factorial recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int... | recursion |
[
{
"role": "user",
"content": "Implement `factorial_recursive`. It should compute factorial recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n ... | recursion |
[
{
"role": "user",
"content": "Provide a Python solution for `factorial_recursive`: compute factorial recursively. Keep it efficient."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if ... | recursion |
[
{
"role": "user",
"content": "Code a function `factorial_recursive` to compute factorial recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if ... | recursion |
[
{
"role": "user",
"content": "Generate a Python function `factorial_recursive` for compute factorial recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be i... | recursion |
[
{
"role": "user",
"content": "Write `factorial_recursive`: compute factorial recursively. Keep it efficient."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise Va... | recursion |
[
{
"role": "user",
"content": "Draft a Python function `factorial_recursive` to compute factorial recursively. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n ... | recursion |
[
{
"role": "user",
"content": "Can you write code for `factorial_recursive` that compute factorial recursively? Use only the standard library."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")... | recursion |
[
{
"role": "user",
"content": "Please provide `factorial_recursive` that compute factorial recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n ... | recursion |
[
{
"role": "user",
"content": "Formulate `factorial_recursive` to compute factorial recursively. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n ... | recursion |
[
{
"role": "user",
"content": "Implement the function `factorial_recursive` (an integer n) -> n factorial. Add a brief docstring."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < ... | recursion |
[
{
"role": "user",
"content": "Provide a Python solution for `factorial_recursive`: compute factorial recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be i... | recursion |
[
{
"role": "user",
"content": "Create a robust `factorial_recursive` that compute factorial recursively. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n <... | recursion |
[
{
"role": "user",
"content": "Add a function `factorial_recursive` that compute factorial recursively. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\... | recursion |
[
{
"role": "user",
"content": "Formulate `factorial_recursive` to compute factorial recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:... | recursion |
[
{
"role": "user",
"content": "Write code for `factorial_recursive` (an integer n) that compute factorial recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\... | recursion |
[
{
"role": "user",
"content": "Write `factorial_recursive` in Python. It should compute factorial recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\... | recursion |
[
{
"role": "user",
"content": "Define a function `factorial_recursive` taking an integer n and returning n factorial. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must b... | recursion |
[
{
"role": "user",
"content": "Write a Python function `factorial_recursive` that compute factorial recursively. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n ... | recursion |
[
{
"role": "user",
"content": "Write a Python function `factorial_recursive` that compute factorial recursively. Keep it efficient."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n ... | recursion |
[
{
"role": "user",
"content": "Create a robust `factorial_recursive` that compute factorial recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:... | recursion |
[
{
"role": "user",
"content": "Make a function `factorial_recursive` to compute factorial recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial_recursive(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n i... | recursion |
[
{
"role": "user",
"content": "Write code for `fibonacci_recursive` (an integer n) that compute Fibonacci recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must ... | recursion |
[
{
"role": "user",
"content": "Implement `fibonacci_recursive`. It should compute Fibonacci recursively. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n m... | recursion |
[
{
"role": "user",
"content": "Define a function `fibonacci_recursive` taking an integer n and returning the nth Fibonacci number. "
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-neg... | recursion |
[
{
"role": "user",
"content": "Write `fibonacci_recursive` handling edge cases; it should compute Fibonacci recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n mus... | recursion |
[
{
"role": "user",
"content": "Make a function `fibonacci_recursive` to compute Fibonacci recursively. Include basic type checks."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negat... | recursion |
[
{
"role": "user",
"content": "Can you write code for `fibonacci_recursive` that compute Fibonacci recursively? Avoid mutating the input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be n... | recursion |
[
{
"role": "user",
"content": "Develop `fibonacci_recursive` such that it compute Fibonacci recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negativ... | recursion |
[
{
"role": "user",
"content": "Formulate `fibonacci_recursive` to compute Fibonacci recursively. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be n... | recursion |
[
{
"role": "user",
"content": "I need a Python helper `fibonacci_recursive` that compute Fibonacci recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must... | recursion |
[
{
"role": "user",
"content": "Create a robust `fibonacci_recursive` that compute Fibonacci recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non... | recursion |
[
{
"role": "user",
"content": "Help me write `fibonacci_recursive` that compute Fibonacci recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negative ... | recursion |
[
{
"role": "user",
"content": "I need a Python helper `fibonacci_recursive` that compute Fibonacci recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n mu... | recursion |
[
{
"role": "user",
"content": "Provide a Python solution for `fibonacci_recursive`: compute Fibonacci recursively. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueE... | recursion |
[
{
"role": "user",
"content": "Help me write `fibonacci_recursive` that compute Fibonacci recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non... | recursion |
[
{
"role": "user",
"content": "Formulate `fibonacci_recursive` to compute Fibonacci recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negative int\")... | recursion |
[
{
"role": "user",
"content": "Implement the function `fibonacci_recursive` (an integer n) -> the nth Fibonacci number. Include basic type checks."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n ... | recursion |
[
{
"role": "user",
"content": "Create a utility function named `fibonacci_recursive` which compute Fibonacci recursively. Use only the standard library."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueErro... | recursion |
[
{
"role": "user",
"content": "Write `fibonacci_recursive` in Python. It should compute Fibonacci recursively. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be no... | recursion |
[
{
"role": "user",
"content": "Help me write `fibonacci_recursive` that compute Fibonacci recursively. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negati... | recursion |
[
{
"role": "user",
"content": "Implement the function `fibonacci_recursive` (an integer n) -> the nth Fibonacci number. Use only the standard library."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(... | recursion |
[
{
"role": "user",
"content": "Implement `fibonacci_recursive` returning the nth Fibonacci number given an integer n. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(... | recursion |
[
{
"role": "user",
"content": "Create a robust `fibonacci_recursive` that compute Fibonacci recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be n... | recursion |
[
{
"role": "user",
"content": "Write `fibonacci_recursive`: compute Fibonacci recursively. "
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negative int\")\n if n <= 1:\n re... | recursion |
[
{
"role": "user",
"content": "Develop `fibonacci_recursive` such that it compute Fibonacci recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non... | recursion |
[
{
"role": "user",
"content": "Please provide `fibonacci_recursive` that compute Fibonacci recursively. Add a brief docstring."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negative... | recursion |
[
{
"role": "user",
"content": "Write a reusable function `fibonacci_recursive` which compute Fibonacci recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"... | recursion |
[
{
"role": "user",
"content": "Formulate `fibonacci_recursive` to compute Fibonacci recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negativ... | recursion |
[
{
"role": "user",
"content": "Draft a Python function `fibonacci_recursive` to compute Fibonacci recursively. Keep it efficient."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negat... | recursion |
[
{
"role": "user",
"content": "Implement `fibonacci_recursive` with proper validation: compute Fibonacci recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"... | recursion |
[
{
"role": "user",
"content": "Construct `fibonacci_recursive` to compute Fibonacci recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueError(\"n must be non-negat... | recursion |
[
{
"role": "user",
"content": "Write `fibonacci_recursive` handling edge cases; it should compute Fibonacci recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def fibonacci_recursive(n: int) -> int:\n if not isinstance(n, int) or n < 0:\n raise ValueErr... | recursion |
[
{
"role": "user",
"content": "Draft a Python function `power_recursive` to compute base^exp recursively. Include basic type checks."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n... | recursion |
[
{
"role": "user",
"content": "Write code for `power_recursive` (base and exp) that compute base^exp recursively. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp... | recursion |
[
{
"role": "user",
"content": "Build a function `power_recursive` that compute base^exp recursively, with edge-case handling. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")... | recursion |
[
{
"role": "user",
"content": "Please provide `power_recursive` that compute base^exp recursively. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n ... | recursion |
[
{
"role": "user",
"content": "Implement `power_recursive` with proper validation: compute base^exp recursively. Use only the standard library."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if... | recursion |
[
{
"role": "user",
"content": "Add a function `power_recursive` that compute base^exp recursively. Use only the standard library."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n ... | recursion |
[
{
"role": "user",
"content": "Create `power_recursive(base and exp)` returning the power. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n ret... | recursion |
[
{
"role": "user",
"content": "Add a function `power_recursive` that compute base^exp recursively. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp... | recursion |
[
{
"role": "user",
"content": "Create a utility function named `power_recursive` which compute base^exp recursively. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n... | recursion |
[
{
"role": "user",
"content": "Can you write code for `power_recursive` that compute base^exp recursively? Use only the standard library."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp <... | recursion |
[
{
"role": "user",
"content": "Draft a Python function `power_recursive` to compute base^exp recursively. "
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n return 1 / power(b... | recursion |
[
{
"role": "user",
"content": "Provide a Python solution for `power_recursive`: compute base^exp recursively. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\... | recursion |
[
{
"role": "user",
"content": "Write `power_recursive` handling edge cases; it should compute base^exp recursively. Keep it efficient."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:... | recursion |
[
{
"role": "user",
"content": "Code a function `power_recursive` to compute base^exp recursively. Keep it efficient."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n return 1... | recursion |
[
{
"role": "user",
"content": "Create `power_recursive(base and exp)` returning the power. Include basic type checks."
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n return ... | recursion |
[
{
"role": "user",
"content": "Create a robust `power_recursive` that compute base^exp recursively. "
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n return 1 / power(base, -... | recursion |
[
{
"role": "user",
"content": "Implement the function `power_recursive` (base and exp) -> the power. "
},
{
"role": "assistant",
"content": "def power(base, exp: int):\n if not isinstance(exp, int):\n raise TypeError(\"exp must be int\")\n if exp < 0:\n return 1 / power(base, ... | recursion |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.