# Ceteris Lab downloadable Python script
# Course: Fundamentals of Python for Financial Econometrics

def simple_return(start_price: float, end_price: float) -> float:
    """Return the decimal holding-period return."""
    if start_price <= 0:
        raise ValueError("start_price must be positive")
    return end_price / start_price - 1

print(simple_return(100, 105))

import math

assert math.isclose(simple_return(100, 105), 0.05)
try:
    simple_return(0, 105)
except ValueError as err:
    print(err)
