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 check(name,actual,expected):
 assert actual==expected,(name,actual,expected)
 checks.append({'case':name,'actual':str(actual),'expected':str(expected)})
check('Revenue and price alone imply conditional volume factor, not causation',F(115,110),F(23,22))
check('Constant-mix volume growth percent',100*(F(115,110)-1),F(50,11))
check('Option A original simple recovery',F(8000,1000),F(8))
check('Option A funding shortfall',8000-5000,3000)
check('Option B original simple recovery',F(3000,500),F(6))
check('Option B funds remaining before other uses',5000-3000,2000)
check('Option A recurring benefit after added financing cost',1000-200,800)
check('Companion narrow revised recovery, not complete financing valuation',F(8000,800),F(10))
check('Absolute profit growth fraction',F(3000-2000,2000),F(1,2))
check('Original reported margin',F(2000,40000),F(1,20))
check('Later reported margin',F(3000,75000),F(1,25))
check('Margin change percentage points',100*(F(3000,75000)-F(2000,40000)),F(-1))
check('Express analytical adjusted profit',3000+1000,4000)
check('Express analytical adjusted margin',F(4000,75000),F(4,75))
check('Base plus proposed contingency authority',4800+700,5500)
check('Machine gross simple payback months',F(12000,500),F(24))
check('Machine narrow original net benefit',500-100,400)
check('Machine narrow original net payback months',F(12000,400),F(30))
check('Verified lower cash saving net of maintenance',300-100,200)
check('Changed-case narrow payback months',F(12000,200),F(60))
check('Maintenance exceeding cash saving',300-350,-50)
assert 300-350<=0
checks.append({'case':'No positive simple payback when recurring net benefit is nonpositive','passed':True})
print(json.dumps({'passed':True,'scope':'Synthetic numerical mechanisms only; no automated grading of writing, no causal proof or complete investment valuation','checks':checks}))

Related chapters