Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added examples/mathkit/__init__.py
Empty file.
27 changes: 27 additions & 0 deletions examples/mathkit/operations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Basic arithmetic operations for the mathkit example package."""


def add(a: float, b: float) -> float:
"""Return the sum of ``a`` and ``b``."""
return a + b


def subtract(a: float, b: float) -> float:
"""Return the difference of ``a`` and ``b``."""
return a - b


def multiply(a: float, b: float) -> float:
"""Return the product of ``a`` and ``b``."""
return a * b


def divide(a: float, b: float) -> float:
"""Return the quotient of ``a`` divided by ``b``.

Raises:
ValueError: If ``b`` is zero.
"""
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b
Loading