"""Deliberately broken starter for W05. Do not use for real finance."""
prices = [("2026-01-03", "102.0"), ("2026-01-01", "100.0"), ("2026-01-02", "0")]

# The program should sort by date, reject non-positive prices, and calculate returns.
# It currently contains type, ordering, and zero-division problems.
prices.sort(reverse=True)
returns = []
for i in range(1, len(prices)):
    previous = prices[i - 1][1]
    current = prices[i][1]
    returns.append((current - previous) / previous)
print(returns)
