Eureka/demo/fixture/tabsplit.py
Eureka 37c8c04e6a demo: tabsplit fixture with a seeded rule-3 bug, setup script, Soul brief
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 03:19:09 +00:00

10 lines
300 B
Python

"""Split a bill between payers. See SPEC.md for the rules."""
def split_cents(total, n):
if n < 1:
raise ValueError("need at least one payer")
share = round(total / n)
shares = [share] * n
shares[-1] += total - share * n # last payer absorbs the rounding
return shares