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 math import ceil,isclose
import json
checks=[]
def check(name,condition):
 assert condition,name
 checks.append(name)
check('vendor complete scope3000',6000+3000==9000 and 9000-8000==1000)
check('vendor changed workaround1000',6000+1000==7000 and 8000-7000==1000)
check('fictional processing-time difference',10-8==2 and (10-8)/10==.2)
check('conditional workload transfer',300*2==600 and 600/60==10)
check('time valuation not actual payroll assertion',10*30==300)
check('retained break-even exact',6000/150==40 and 40*150-6000==0 and 41*150-6000==150)
check('changed contribution whole-job threshold',ceil(6000/147)==41)
check('rounding cannot erase shortfall',40*147-6000==-120 and 41*147-6000==27)
check('capacity40 fails changed threshold',40<ceil(6000/147))
check('retained margin points',isclose(.24-.2,.04))
check('retained relative margin change',isclose((.24-.2)/.2,.2))
check('retained amounts',100000*.2==20000 and 80000*.24==19200)
check('retained amount decline',19200-20000==-800 and (19200-20000)/20000==-.04)
check('changed unchanged revenue',100000*.24==24000 and (24000-20000)/20000==.2)
check('original profit and margin',50000-40000==10000 and 10000/50000==.2)
check('base operating cash',30000-40000==-10000)
check('base cash before draw',15000+30000-40000==5000)
check('base proposed draw deficit',15000+30000-40000-9000==-4000)
check('depreciation changed paid cost',40000-5000==35000)
check('depreciation changed cash',15000+30000-35000==10000 and 10000-9000==1000)
check('reserve constraint',10000-3000==7000 and 3000-(10000-9000)==2000)
check('complete required price',10000+2000==12000)
check('optional scope remains different',12000-10000==2000)
check('rubric total',5*6==30)
if __name__=='__main__':print(json.dumps(dict(passed=True,checks=checks,calculated=dict(wholeJobThreshold=41,fortyJobResult=-120,fortyOneJobResult=27,oldProfit=20000,newProfit=19200,basePreDrawCash=5000,basePostDrawCash=-4000,noncashPreDrawCash=10000,noncashPostDrawCash=1000,reserveConstrainedDraw=7000)),indent=2))

Related chapters