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('Direct stated late-job recovery cost',10*40,400)
ck('Qualified partner contribution tradeoff',10*25,250)
ck('Conditional partner advantage before other effects',400-250,150)
ck('Original form completion rate',F(600,1000),F(3,5))
ck('Changed form completion rate',F(800,1000),F(4,5))
ck('Unchanged paid conversion',F(300,1000),F(3,10))
ck('Added support calls',90-50,40)
ck('Controlled paid conversion case',F(360,1000),F(9,25))
ck('Controlled paid conversion change percentage points',100*F(360-300,1000),F(6))
ck('Separate promotion contribution after cost',10*(140-70)-150,550)
ck('Separate promotion baseline three regular buyers',3*(180-70),330)
ck('Separate promotion incremental original',550-330,220)
ck('Separate promotion incremental six regular buyers',550-6*110,-110)
ck('Mandatory total illustrative price',75+60,135)
ck('Complete failure cost supplied model',30+45,75)
ck('Prevention at fifteen failures',15*75-900,225)
ck('Prevention at ten failures',10*75-900,-150)
ck('Twelve preventions tie',12*75-900,0)
ck('Thirteen preventions strictly improve',13*75-900,75)
ck('Original cohort retention',F(90,120),F(3,4))
ck('Original cohort plus acquisitions active count',90+30,120)
ck('Changed cohort retention',F(60,120),F(1,2))
ck('Changed cohort plus acquisitions same active count',60+60,120)
ck('Cumulative promoted revenue',8*150,1200)
ck('Cumulative service cost',8*80,640)
ck('Cumulative promoted contribution after campaign',8*(150-80)-200,360)
ck('Cumulative baseline two regular buyers',2*(200-80),240)
ck('Cumulative original incremental contribution',360-240,120)
ck('Cumulative four-displaced-buyer case',360-4*120,-120)
ck('New transfer extra recovery at fifteen',8*15,120)
ck('New transfer incremental after fifteen recovery each',360-240-8*15,0)
ck('Changed transfer incremental after thirty recovery each',360-240-8*30,-120)
print(json.dumps(dict(passed=True,scope='Synthetic service-business mechanisms only; no clinical outcome, legal remedy, observed customer test or learner proficiency',checks=checks)))

Related chapters