conversations listlengths 2 2 | source stringclasses 8
values |
|---|---|
[
{
"role": "user",
"content": "Define a function `fibonacci` taking an integer n and returning the nth Fibonacci number. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def fibonacci(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must ... | math |
[
{
"role": "user",
"content": "Implement `fibonacci` with proper validation: compute the nth Fibonacci number. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def fibonacci(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n ... | math |
[
{
"role": "user",
"content": "Define a function `fibonacci` taking an integer n and returning the nth Fibonacci number. Include basic type checks."
},
{
"role": "assistant",
"content": "def fibonacci(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n ... | math |
[
{
"role": "user",
"content": "Construct `fibonacci` to compute the nth Fibonacci number. Use only the standard library."
},
{
"role": "assistant",
"content": "def fibonacci(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise V... | math |
[
{
"role": "user",
"content": "Implement the function `fibonacci` (an integer n) -> the nth Fibonacci number. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def fibonacci(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n <... | math |
[
{
"role": "user",
"content": "Generate a Python function `fibonacci` for compute the nth Fibonacci number. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def fibonacci(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n <... | math |
[
{
"role": "user",
"content": "Write code for `fibonacci` (an integer n) that compute the nth Fibonacci number. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def fibonacci(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:... | math |
[
{
"role": "user",
"content": "Make a function `factorial` to compute the factorial of n. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise V... | math |
[
{
"role": "user",
"content": "Write `factorial` in Python. It should compute the factorial of n. Include basic type checks."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n rai... | math |
[
{
"role": "user",
"content": "Can you write code for `factorial` that compute the factorial of n? Include basic type checks."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ra... | math |
[
{
"role": "user",
"content": "Create `factorial(an integer n)` returning n factorial. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise Va... | math |
[
{
"role": "user",
"content": "Write `factorial` in Python. It should compute the factorial of n. "
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise ValueError(\"n must be ... | math |
[
{
"role": "user",
"content": "Can you write code for `factorial` that compute the factorial of n? Avoid mutating the input."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n rai... | math |
[
{
"role": "user",
"content": "Generate a Python function `factorial` for compute the factorial of n. Add a brief docstring."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n rai... | math |
[
{
"role": "user",
"content": "Produce a clean implementation of `factorial`: compute the factorial of n. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Write a reusable function `factorial` which compute the factorial of n. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n... | math |
[
{
"role": "user",
"content": "Implement `factorial` with proper validation: compute the factorial of n. Include basic type checks."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Implement `factorial`. It should compute the factorial of n. Use only the standard library."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise... | math |
[
{
"role": "user",
"content": "Write a reusable function `factorial` which compute the factorial of n. Keep it efficient."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise ... | math |
[
{
"role": "user",
"content": "Please provide `factorial` that compute the factorial of n. Keep it efficient."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise ValueError(\... | math |
[
{
"role": "user",
"content": "Implement `factorial(an integer n)` to compute the factorial of n. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Draft a Python function `factorial` to compute the factorial of n. Keep it efficient."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise Value... | math |
[
{
"role": "user",
"content": "Create `factorial(an integer n)` returning n factorial. Use only the standard library."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise Valu... | math |
[
{
"role": "user",
"content": "Define a function `factorial` taking an integer n and returning n factorial. Add a brief docstring."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Make a function `factorial` to compute the factorial of n. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise... | math |
[
{
"role": "user",
"content": "Write a Python function `factorial` that compute the factorial of n. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Add a function `factorial` that compute the factorial of n. Add a brief docstring."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise ValueErr... | math |
[
{
"role": "user",
"content": "Implement `factorial` returning n factorial given an integer n. "
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise ValueError(\"n must be non... | math |
[
{
"role": "user",
"content": "Make a function `factorial` to compute the factorial of n. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Develop `factorial` such that it compute the factorial of n. "
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise ValueError(\"n must be non-ne... | math |
[
{
"role": "user",
"content": "Generate a Python function `factorial` for compute the factorial of n. Include basic type checks."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Write code for `factorial` (an integer n) that compute the factorial of n. Keep it efficient."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n rai... | math |
[
{
"role": "user",
"content": "Add a function `factorial` that compute the factorial of n. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "I need a Python helper `factorial` that compute the factorial of n. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Construct `factorial` to compute the factorial of n. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise Value... | math |
[
{
"role": "user",
"content": "Construct `factorial` to compute the factorial of n. "
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise ValueError(\"n must be non-negative\"... | math |
[
{
"role": "user",
"content": "Create `factorial(an integer n)` returning n factorial. Add a brief docstring."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise ValueError(\... | math |
[
{
"role": "user",
"content": "Provide a Python solution for `factorial`: compute the factorial of n. Use only the standard library."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n ... | math |
[
{
"role": "user",
"content": "Code a function `factorial` to compute the factorial of n. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def factorial(n: int) -> int:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 0:\n raise V... | math |
[
{
"role": "user",
"content": "Create a robust `is_prime` that test whether an integer is prime. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Implement `is_prime` with proper validation: test whether an integer is prime. Add a brief docstring."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Write a reusable function `is_prime` which test whether an integer is prime. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Add a function `is_prime` that test whether an integer is prime. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return... | math |
[
{
"role": "user",
"content": "Develop `is_prime` such that it test whether an integer is prime. Include basic type checks."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n retu... | math |
[
{
"role": "user",
"content": "Add a function `is_prime` that test whether an integer is prime. Include basic type checks."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n retur... | math |
[
{
"role": "user",
"content": "Implement `is_prime(an integer n)` to test whether an integer is prime. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Please provide `is_prime` that test whether an integer is prime. Keep it efficient."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return False\... | math |
[
{
"role": "user",
"content": "Can you write code for `is_prime` that test whether an integer is prime? Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Produce a clean implementation of `is_prime`: test whether an integer is prime. Add a brief docstring."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Write code for `is_prime` (an integer n) that test whether an integer is prime. Include basic type checks."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:... | math |
[
{
"role": "user",
"content": "Please provide `is_prime` that test whether an integer is prime. "
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return False\n if n % 2 == 0... | math |
[
{
"role": "user",
"content": "Draft a Python function `is_prime` to test whether an integer is prime. "
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return False\n if n %... | math |
[
{
"role": "user",
"content": "Create a utility function named `is_prime` which test whether an integer is prime. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\... | math |
[
{
"role": "user",
"content": "Write `is_prime`: test whether an integer is prime. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return False\n i... | math |
[
{
"role": "user",
"content": "Write a Python function `is_prime` that test whether an integer is prime. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Formulate `is_prime` to test whether an integer is prime. Use only the standard library."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return F... | math |
[
{
"role": "user",
"content": "Develop `is_prime` such that it test whether an integer is prime. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Write a reusable function `is_prime` which test whether an integer is prime. "
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return False\n i... | math |
[
{
"role": "user",
"content": "Implement the function `is_prime` (an integer n) -> True if n is prime. "
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return False\n if n %... | math |
[
{
"role": "user",
"content": "Define a function `is_prime` taking an integer n and returning True if n is prime. Include basic type checks."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n <... | math |
[
{
"role": "user",
"content": "Formulate `is_prime` to test whether an integer is prime. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return... | math |
[
{
"role": "user",
"content": "Can you write code for `is_prime` that test whether an integer is prime? Add a brief docstring."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n r... | math |
[
{
"role": "user",
"content": "Create `is_prime(an integer n)` returning True if n is prime. Use only the standard library."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n retu... | math |
[
{
"role": "user",
"content": "Develop `is_prime` such that it test whether an integer is prime. Keep it efficient."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return False... | math |
[
{
"role": "user",
"content": "Define a function `is_prime` taking an integer n and returning True if n is prime. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n ... | math |
[
{
"role": "user",
"content": "Build a function `is_prime` that test whether an integer is prime, with edge-case handling. "
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n retu... | math |
[
{
"role": "user",
"content": "Implement `is_prime`. It should test whether an integer is prime. Add a brief docstring."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n return F... | math |
[
{
"role": "user",
"content": "Help me write `is_prime` that test whether an integer is prime. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Add a function `is_prime` that test whether an integer is prime. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n r... | math |
[
{
"role": "user",
"content": "Generate a Python function `is_prime` for test whether an integer is prime. Add a brief docstring."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Formulate `is_prime` to test whether an integer is prime. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def is_prime(n: int) -> bool:\n if not isinstance(n, int):\n raise TypeError(\"n must be int\")\n if n < 2:\n ... | math |
[
{
"role": "user",
"content": "Implement the function `gcd` (integers a and b) -> the gcd. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be in... | math |
[
{
"role": "user",
"content": "Write `gcd`: compute the greatest common divisor. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\... | math |
[
{
"role": "user",
"content": "Make a function `gcd` to compute the greatest common divisor. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\... | math |
[
{
"role": "user",
"content": "Create `gcd(integers a and b)` returning the gcd. Include basic type checks."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a, b =... | math |
[
{
"role": "user",
"content": "Implement `gcd` with proper validation: compute the greatest common divisor. Add a brief docstring."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b mus... | math |
[
{
"role": "user",
"content": "Write `gcd` in Python. It should compute the greatest common divisor. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b ... | math |
[
{
"role": "user",
"content": "Add a function `gcd` that compute the greatest common divisor. Add a brief docstring."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n ... | math |
[
{
"role": "user",
"content": "Implement `gcd` returning the gcd given integers a and b. Add a brief docstring."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a,... | math |
[
{
"role": "user",
"content": "Construct `gcd` to compute the greatest common divisor. "
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a, b = abs(a), abs(b)\n ... | math |
[
{
"role": "user",
"content": "Implement `gcd` with proper validation: compute the greatest common divisor. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a a... | math |
[
{
"role": "user",
"content": "Code a function `gcd` to compute the greatest common divisor. Keep it efficient."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a,... | math |
[
{
"role": "user",
"content": "Produce a clean implementation of `gcd`: compute the greatest common divisor. Add a brief docstring."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b mu... | math |
[
{
"role": "user",
"content": "Can you write code for `gcd` that compute the greatest common divisor? Avoid mutating the input."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must b... | math |
[
{
"role": "user",
"content": "Write `gcd` handling edge cases; it should compute the greatest common divisor. Include basic type checks."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a an... | math |
[
{
"role": "user",
"content": "Code a function `gcd` to compute the greatest common divisor. "
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a, b = abs(a), abs(b... | math |
[
{
"role": "user",
"content": "Implement `gcd` with proper validation: compute the greatest common divisor. Include basic type checks."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b... | math |
[
{
"role": "user",
"content": "Help me write `gcd` that compute the greatest common divisor. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b ... | math |
[
{
"role": "user",
"content": "Write `gcd` in Python. It should compute the greatest common divisor. "
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a, b = abs(a... | math |
[
{
"role": "user",
"content": "Create `gcd(integers a and b)` returning the gcd. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a, b = ... | math |
[
{
"role": "user",
"content": "Draft a Python function `gcd` to compute the greatest common divisor. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"... | math |
[
{
"role": "user",
"content": "Implement the function `gcd` (integers a and b) -> the gcd. Include basic type checks."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n... | math |
[
{
"role": "user",
"content": "Create a robust `gcd` that compute the greatest common divisor. "
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a, b = abs(a), abs... | math |
[
{
"role": "user",
"content": "Develop `gcd` such that it compute the greatest common divisor. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must b... | math |
[
{
"role": "user",
"content": "Create a utility function named `gcd` which compute the greatest common divisor. "
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a... | math |
[
{
"role": "user",
"content": "Draft a Python function `gcd` to compute the greatest common divisor. Keep it efficient."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")... | math |
[
{
"role": "user",
"content": "Add a function `gcd` that compute the greatest common divisor. "
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n a, b = abs(a), abs(... | math |
[
{
"role": "user",
"content": "Provide a Python solution for `gcd`: compute the greatest common divisor. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a an... | math |
[
{
"role": "user",
"content": "Implement `gcd`. It should compute the greatest common divisor. Add a brief docstring."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be int\")\n... | math |
[
{
"role": "user",
"content": "Help me write `gcd` that compute the greatest common divisor. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def gcd(a: int, b: int) -> int:\n if not (isinstance(a, int) and isinstance(b, int)):\n raise TypeError(\"a and b must be in... | math |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.