Lawfare Group → Knowledge Institute → Lawfare Academy
Reproduce the BBA integrated case
Copy this complete Python 3 standard-library script into verify.py and run python verify.py. It uses synthetic data and makes no network calls or learner-record queries. It checks nine scenarios, profit-to-cash reconciliation, closing position, break-even and the funding constraint. Arithmetic checks are separate from substantive program review and achieved learning outcomes.
Return to the teaching and assumptions
from fractions import Fraction as F
import json
def scenario(jobs=50,collection=F(2,5),fixed=12000,hold=0):
revenue=jobs*1000;direct=jobs*550;profit=revenue-direct-fixed
receipts=revenue*collection;available=receipts*(1-hold)
closing=4000+available-direct-fixed-8000
funding=max(0,5000-closing)
receivables=revenue-receipts
restricted=receipts*hold
assert closing-4000==profit-receivables-restricted-8000
assert 5000+receivables+restricted+8000==4000+funding+profit
return dict(profit=profit,receipts=receipts,closing=closing,funding=funding,receivables=receivables,restricted=restricted)
fixtures=[(50,F(2,5),12000,0,(10500,-23500,28500)),(50,F(7,10),12000,0,(10500,-8500,13500)),(60,F(2,5),14000,0,(13000,-27000,32000)),(60,F(7,10),14000,0,(13000,-9000,14000)),(40,F(2,5),12000,0,(6000,-22000,27000)),(50,F(4,5),12000,0,(10500,-3500,8500)),(40,F(7,10),12000,0,(6000,-10000,15000)),(55,F(7,10),14000,0,(10750,-9750,14750)),(50,F(7,10),12000,F(1,10),(10500,-12000,17000))]
results=[]
for jobs,collection,fixed,hold,expected in fixtures:
r=scenario(jobs,collection,fixed,hold)
assert (r['profit'],r['closing'],r['funding'])==expected
results.append(dict(jobs=jobs,collection=str(collection),hold=str(hold),**{k:float(v) for k,v in r.items()}))
assert F(12000,450)==F(80,3) and 26*450-12000<0 and 27*450-12000>0
assert scenario(50,F(7,10),12000,F(1,10))['funding']-16000==1000
print(json.dumps({'allPassed':True,'scenarios':results,'scope':'Synthetic arithmetic and reconciliation, not business, legal or learner approval'},indent=2))