Lawfare Group → Knowledge Institute → Lawfare Academy

Reproduce the worked examples

Copy the complete code below into a UTF-8 file named verify.py and run python verify.py with Python 3. It uses only the standard library and performs exact or rational synthetic calculations. It does not access a network or learner records. Assertions fail if the expected synthetic results change.

These checks verify the stated arithmetic and query behavior, not independent academic acceptance or production migration safety.

from fractions import Fraction as F
import json
checks=[]
def ck(name,actual,expected):
 assert actual==expected,(name,actual,expected)
 checks.append(dict(case=name,actual=str(actual),expected=str(expected)))
ck('Separate paid-trial contribution before omitted costs',5*(100-90),50)
ck('Separate normal renewal contribution per customer',150-90,60)
ck('Three-stage baseline accepted capacity',min(80,50,60),50)
ck('Nonbinding first-stage improvement capacity',min(100,50,60),50)
ck('Middle-stage improvement shifts constraint',min(80,65,60),60)
ck('Middle-stage added contribution before investment',(60-50)*200,2000)
ck('Quality changed accepted capacity',min(80,65,55),55)
ck('Quality changed added contribution',5*200,1000)
ck('Independent finance profit',30000-15000-8000,7000)
ck('Independent finance receivables growth',30000-18000,12000)
ck('Independent finance operating cash',18000-15000-8000,-5000)
ck('Independent finance closing cash',8000+18000-15000-8000,3000)
ck('Supplier credit payables growth',F(15000,3),F(5000))
ck('Supplier credit closing cash with unchanged profit',3000+5000,8000)
ck('Crew stated-demand steady contribution',25*150,3750)
ck('Crew steady deficit at stated demand',25*150-4500,-750)
ck('Crew ramp-up accepted jobs',25*F(3,5),F(15))
ck('Crew ramp-up deficit',15*150-4500,-2250)
ck('Crew steady break-even jobs',F(4500,150),F(30))
ck('Higher committed demand steady surplus before omitted effects',35*150-4500,750)
ck('Cumulative accepted baseline',min(60,50,40),40)
ck('Cumulative baseline revenue',40*500,20000)
ck('Cumulative baseline direct cost',40*300,12000)
ck('Cumulative baseline profit',20000-12000-6000,2000)
ck('Cumulative baseline current cash collections',20000*F(1,2),F(10000))
ck('Cumulative baseline cash after payments',5000+10000-12000-6000,-3000)
ck('Cumulative eighty-percent collection cash',5000+20000*F(4,5)-12000-6000,F(3000))
ck('Cumulative eighty-percent reserve shortfall',5000-3000,2000)
ck('New review intervention accepted output',min(60,50,55),50)
ck('New review intervention revenue',50*500,25000)
ck('New review intervention profit',25000-15000-6000-1500,2500)
ck('New review intervention profit improvement',2500-2000,500)
ck('New review intervention fifty-percent collections',25000*F(1,2),F(12500))
ck('New review intervention operating cash',12500-15000-7500,-10000)
ck('New review intervention closing cash',5000+12500-15000-7500,-5000)
ck('New review intervention receivables',25000-12500,12500)
ck('New review intervention profit-to-cash bridge',2500-12500,-10000)
ck('New review intervention closing cash deterioration',-5000-(-3000),-2000)
ck('New review intervention eighty-percent closing cash',5000+25000*F(4,5)-15000-7500,F(2500))
ck('New review intervention eighty-percent receivables',25000-20000,5000)
ck('New review intervention hypothetical reserve shortfall',5000-2500,2500)
ck('Same-collection alternative closing-cash difference',2500-3000,-500)
print(json.dumps(dict(passed=True,scope='Synthetic optional-practicum numerical mechanisms; no real placement, organizational authority, private records or observed competence',checks=checks)))

Related chapters