conversations
listlengths
2
2
source
stringclasses
8 values
[ { "role": "user", "content": "Draft a Python function `BST` to implement a binary search tree. " }, { "role": "assistant", "content": "class BSTNode:\n def __init__(self, value):\n self.value = value\n self.left = None\n self.right = None\n\nclass BST:\n def __init__(s...
oop
[ { "role": "user", "content": "Develop `Counter` such that it implement a frequency counter class. " }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = self._counts.get(item, 0)...
oop
[ { "role": "user", "content": "Draft a Python function `Counter` to implement a frequency counter class. Add a brief docstring." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item]...
oop
[ { "role": "user", "content": "Construct `Counter` to implement a frequency counter class. " }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = self._counts.get(item, 0) + 1\n\n...
oop
[ { "role": "user", "content": "Add a function `Counter` that implement a frequency counter class. Use only the standard library." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item...
oop
[ { "role": "user", "content": "Write a reusable function `Counter` which implement a frequency counter class. Avoid mutating the input." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._coun...
oop
[ { "role": "user", "content": "Help me write `Counter` that implement a frequency counter class. Make it robust to invalid input." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[ite...
oop
[ { "role": "user", "content": "Provide a Python solution for `Counter`: implement a frequency counter class. Add a brief docstring." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[i...
oop
[ { "role": "user", "content": "Build a function `Counter` that implement a frequency counter class, with edge-case handling. Use only the standard library." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:...
oop
[ { "role": "user", "content": "Develop `Counter` such that it implement a frequency counter class. Avoid mutating the input." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = ...
oop
[ { "role": "user", "content": "Create `Counter(none)` returning a Counter instance. Avoid mutating the input." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = self._counts.ge...
oop
[ { "role": "user", "content": "Write code for `Counter` (none) that implement a frequency counter class. Add a brief docstring." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item]...
oop
[ { "role": "user", "content": "Implement `Counter`. It should implement a frequency counter class. Include basic type checks." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] =...
oop
[ { "role": "user", "content": "Write `Counter` in Python. It should implement a frequency counter class. Include basic type checks." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[i...
oop
[ { "role": "user", "content": "Write `Counter`: implement a frequency counter class. Make it robust to invalid input." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = self._c...
oop
[ { "role": "user", "content": "Implement `Counter` returning a Counter instance given none. Make it robust to invalid input." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = ...
oop
[ { "role": "user", "content": "Generate a Python function `Counter` for implement a frequency counter class. Handle empty input gracefully." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._...
oop
[ { "role": "user", "content": "Formulate `Counter` to implement a frequency counter class. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[i...
oop
[ { "role": "user", "content": "Provide a Python solution for `Counter`: implement a frequency counter class. Handle empty input gracefully." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._...
oop
[ { "role": "user", "content": "Create a robust `Counter` that implement a frequency counter class. Handle empty input gracefully." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[ite...
oop
[ { "role": "user", "content": "Write `Counter` in Python. It should implement a frequency counter class. Add a brief docstring." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item]...
oop
[ { "role": "user", "content": "Produce a clean implementation of `Counter`: implement a frequency counter class. Use only the standard library." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n se...
oop
[ { "role": "user", "content": "Generate a Python function `Counter` for implement a frequency counter class. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n ...
oop
[ { "role": "user", "content": "Define a function `Counter` taking none and returning a Counter instance. Use only the standard library." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._coun...
oop
[ { "role": "user", "content": "Produce a clean implementation of `Counter`: implement a frequency counter class. Keep it efficient." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[i...
oop
[ { "role": "user", "content": "Write `Counter` handling edge cases; it should implement a frequency counter class. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:...
oop
[ { "role": "user", "content": "Create a utility function named `Counter` which implement a frequency counter class. Include basic type checks." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n sel...
oop
[ { "role": "user", "content": "Can you write code for `Counter` that implement a frequency counter class? Return sensible defaults for edge cases." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n ...
oop
[ { "role": "user", "content": "Write `Counter` handling edge cases; it should implement a frequency counter class. " }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = self._cou...
oop
[ { "role": "user", "content": "Formulate `Counter` to implement a frequency counter class. Handle empty input gracefully." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = sel...
oop
[ { "role": "user", "content": "Please provide `Counter` that implement a frequency counter class. Keep it efficient." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n self._counts[item] = self._co...
oop
[ { "role": "user", "content": "Build a function `Counter` that implement a frequency counter class, with edge-case handling. Add a brief docstring." }, { "role": "assistant", "content": "class Counter:\n def __init__(self):\n self._counts = {}\n\n def add(self, item) -> None:\n ...
oop
[ { "role": "user", "content": "Develop `Rectangle` such that it model a rectangle with area and perimeter. Make it robust to invalid input." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Make a function `Rectangle` to model a rectangle with area and perimeter. Keep it efficient." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise ValueEr...
oop
[ { "role": "user", "content": "Create a robust `Rectangle` that model a rectangle with area and perimeter. Keep it efficient." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise Value...
oop
[ { "role": "user", "content": "Formulate `Rectangle` to model a rectangle with area and perimeter. Add a brief docstring." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise ValueErro...
oop
[ { "role": "user", "content": "Write `Rectangle`: model a rectangle with area and perimeter. Avoid mutating the input." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise ValueError(\...
oop
[ { "role": "user", "content": "Write code for `Rectangle` (width and height) that model a rectangle with area and perimeter. Handle empty input gracefully." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height...
oop
[ { "role": "user", "content": "Implement `Rectangle`. It should model a rectangle with area and perimeter. Add a brief docstring." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise V...
oop
[ { "role": "user", "content": "Provide a Python solution for `Rectangle`: model a rectangle with area and perimeter. Handle empty input gracefully." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Help me write `Rectangle` that model a rectangle with area and perimeter. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Implement `Rectangle(width and height)` to model a rectangle with area and perimeter. " }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise ValueError(\"...
oop
[ { "role": "user", "content": "Implement `Rectangle`. It should model a rectangle with area and perimeter. Keep it efficient." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise Value...
oop
[ { "role": "user", "content": "Create `Rectangle(width and height)` returning a Rectangle instance. Make it robust to invalid input." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n rais...
oop
[ { "role": "user", "content": "Produce a clean implementation of `Rectangle`: model a rectangle with area and perimeter. Avoid mutating the input." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Define a function `Rectangle` taking width and height and returning a Rectangle instance. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or ...
oop
[ { "role": "user", "content": "Produce a clean implementation of `Rectangle`: model a rectangle with area and perimeter. Make it robust to invalid input." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height <...
oop
[ { "role": "user", "content": "Write a Python function `Rectangle` that model a rectangle with area and perimeter. Add a brief docstring." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Implement `Rectangle` with proper validation: model a rectangle with area and perimeter. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or h...
oop
[ { "role": "user", "content": "Implement `Rectangle` returning a Rectangle instance given width and height. Include basic type checks." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ra...
oop
[ { "role": "user", "content": "Can you write code for `Rectangle` that model a rectangle with area and perimeter? Use only the standard library." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Write a reusable function `Rectangle` which model a rectangle with area and perimeter. " }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise ValueError(\...
oop
[ { "role": "user", "content": "Build a function `Rectangle` that model a rectangle with area and perimeter, with edge-case handling. Keep it efficient." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0...
oop
[ { "role": "user", "content": "Write a reusable function `Rectangle` which model a rectangle with area and perimeter. Add a brief docstring." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Write code for `Rectangle` (width and height) that model a rectangle with area and perimeter. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0...
oop
[ { "role": "user", "content": "Please provide `Rectangle` that model a rectangle with area and perimeter. Use only the standard library." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Code a function `Rectangle` to model a rectangle with area and perimeter. " }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise ValueError(\"dimensions m...
oop
[ { "role": "user", "content": "Write `Rectangle` in Python. It should model a rectangle with area and perimeter. Keep it efficient." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise...
oop
[ { "role": "user", "content": "Generate a Python function `Rectangle` for model a rectangle with area and perimeter. Make it robust to invalid input." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\...
oop
[ { "role": "user", "content": "Write a Python function `Rectangle` that model a rectangle with area and perimeter. " }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise ValueError(\"di...
oop
[ { "role": "user", "content": "Provide a Python solution for `Rectangle`: model a rectangle with area and perimeter. " }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise ValueError(\"...
oop
[ { "role": "user", "content": "Add a function `Rectangle` that model a rectangle with area and perimeter. Avoid mutating the input." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n raise...
oop
[ { "role": "user", "content": "Write a Python function `Rectangle` that model a rectangle with area and perimeter. Avoid mutating the input." }, { "role": "assistant", "content": "class Rectangle:\n def __init__(self, width: float, height: float):\n if width < 0 or height < 0:\n ...
oop
[ { "role": "user", "content": "Build a function `Point` that model a 2D point with distance, with edge-case handling. Return sensible defaults for edge cases." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self....
oop
[ { "role": "user", "content": "Develop `Point` such that it model a 2D point with distance. " }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_to(self, other: \"Po...
oop
[ { "role": "user", "content": "Write a reusable function `Point` which model a 2D point with distance. Use only the standard library." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y...
oop
[ { "role": "user", "content": "Write a Python function `Point` that model a 2D point with distance. Avoid mutating the input." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n ...
oop
[ { "role": "user", "content": "Write code for `Point` (x and y) that model a 2D point with distance. " }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_to(self, ot...
oop
[ { "role": "user", "content": "Write `Point` in Python. It should model a 2D point with distance. " }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_to(self, other...
oop
[ { "role": "user", "content": "Construct `Point` to model a 2D point with distance. Handle empty input gracefully." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distanc...
oop
[ { "role": "user", "content": "Provide a Python solution for `Point`: model a 2D point with distance. Add a brief docstring." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n d...
oop
[ { "role": "user", "content": "Implement `Point` returning a Point instance given x and y. Handle empty input gracefully." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def ...
oop
[ { "role": "user", "content": "Implement `Point` with proper validation: model a 2D point with distance. Add a brief docstring." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n ...
oop
[ { "role": "user", "content": "I need a Python helper `Point` that model a 2D point with distance. Use only the standard library." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n...
oop
[ { "role": "user", "content": "Write a Python function `Point` that model a 2D point with distance. Include basic type checks." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n ...
oop
[ { "role": "user", "content": "Help me write `Point` that model a 2D point with distance. Handle empty input gracefully." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def d...
oop
[ { "role": "user", "content": "Create a robust `Point` that model a 2D point with distance. Keep it efficient." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_to...
oop
[ { "role": "user", "content": "Create a utility function named `Point` which model a 2D point with distance. " }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_to(...
oop
[ { "role": "user", "content": "Produce a clean implementation of `Point`: model a 2D point with distance. Use only the standard library." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y ...
oop
[ { "role": "user", "content": "Define a function `Point` taking x and y and returning a Point instance. Make it robust to invalid input." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y ...
oop
[ { "role": "user", "content": "Develop `Point` such that it model a 2D point with distance. Include basic type checks." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def dis...
oop
[ { "role": "user", "content": "Write a reusable function `Point` which model a 2D point with distance. Handle empty input gracefully." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y...
oop
[ { "role": "user", "content": "Code a function `Point` to model a 2D point with distance. Keep it efficient." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_to(s...
oop
[ { "role": "user", "content": "Generate a Python function `Point` for model a 2D point with distance. Add a brief docstring." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n d...
oop
[ { "role": "user", "content": "Implement the function `Point` (x and y) -> a Point instance. Use only the standard library." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n de...
oop
[ { "role": "user", "content": "I need a Python helper `Point` that model a 2D point with distance. Make it robust to invalid input." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n...
oop
[ { "role": "user", "content": "Develop `Point` such that it model a 2D point with distance. Use only the standard library." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def...
oop
[ { "role": "user", "content": "Write code for `Point` (x and y) that model a 2D point with distance. Add a brief docstring." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n de...
oop
[ { "role": "user", "content": "Implement `Point` returning a Point instance given x and y. Avoid mutating the input." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def dista...
oop
[ { "role": "user", "content": "Implement `Point(x and y)` to model a 2D point with distance. Avoid mutating the input." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def dis...
oop
[ { "role": "user", "content": "Provide a Python solution for `Point`: model a 2D point with distance. " }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_to(self, o...
oop
[ { "role": "user", "content": "Generate a Python function `Point` for model a 2D point with distance. Keep it efficient." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def d...
oop
[ { "role": "user", "content": "Generate a Python function `Point` for model a 2D point with distance. " }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_to(self, o...
oop
[ { "role": "user", "content": "Code a function `Point` to model a 2D point with distance. Add a brief docstring." }, { "role": "assistant", "content": "import math\n\nclass Point:\n def __init__(self, x: float = 0.0, y: float = 0.0):\n self.x = x\n self.y = y\n\n def distance_...
oop
[ { "role": "user", "content": "Write `Timer`: model a simple countdown timer. Include basic type checks." }, { "role": "assistant", "content": "class Timer:\n def __init__(self, seconds: int):\n if seconds < 0:\n raise ValueError(\"seconds must be non-negative\")\n sel...
oop
[ { "role": "user", "content": "Construct `Timer` to model a simple countdown timer. Avoid mutating the input." }, { "role": "assistant", "content": "class Timer:\n def __init__(self, seconds: int):\n if seconds < 0:\n raise ValueError(\"seconds must be non-negative\")\n ...
oop
[ { "role": "user", "content": "Provide a Python solution for `Timer`: model a simple countdown timer. Add a brief docstring." }, { "role": "assistant", "content": "class Timer:\n def __init__(self, seconds: int):\n if seconds < 0:\n raise ValueError(\"seconds must be non-nega...
oop
[ { "role": "user", "content": "Construct `Timer` to model a simple countdown timer. Make it robust to invalid input." }, { "role": "assistant", "content": "class Timer:\n def __init__(self, seconds: int):\n if seconds < 0:\n raise ValueError(\"seconds must be non-negative\")\...
oop
[ { "role": "user", "content": "Write a Python function `Timer` that model a simple countdown timer. " }, { "role": "assistant", "content": "class Timer:\n def __init__(self, seconds: int):\n if seconds < 0:\n raise ValueError(\"seconds must be non-negative\")\n self.re...
oop
[ { "role": "user", "content": "Write code for `Timer` (seconds) that model a simple countdown timer. Handle empty input gracefully." }, { "role": "assistant", "content": "class Timer:\n def __init__(self, seconds: int):\n if seconds < 0:\n raise ValueError(\"seconds must be n...
oop