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.

"""Original synthetic owner-practice laboratory, Python3 standard library only.
Distinct weekly, job, staffing, snapshot and annual files are not actual records.
No network, production access, worker classification or learner operations.
"""
from fractions import Fraction as F
from math import ceil
import json
checks={}
def check(name,a,b):
 assert a==b,(name,a,b)
 checks[name]=str(a)
billable=35-7-4
check('billable owner hours',billable,24)
check('weekly revenue',billable*100,2400)
check('weekly variable cost',billable*30,720)
subtotal=billable*70-500
check('weekly subtotal before owner labor',subtotal,1180)
check('weekly after owner labor allowance',subtotal-900,280)
check('changed administration billable hours',35-10-4,21)
check('changed administration residual',21*70-500-900,70)
check('growth required owner hours',32+9+4,45)
check('growth pre-labor subtotal',32*70-650,1590)
assert 45>35
cost=6*40+180+30
check('job cost',cost,450)
check('exact30percent margin price',F(cost,1)/F(7,10),F(4500,7))
check('rounded-up original quote',ceil(F(4500,7)),643)
check('actual margin at643',F(643-cost,643),F(193,643))
check('30percent markup price',cost*F(13,10),585)
check('margin under30percent markup',F(585-cost,585),F(3,13))
check('expected callback cost',F(1,10)*100,10)
check('callback-overlay cost',cost+10,460)
check('callback-overlay exact target',F(460,1)/F(7,10),F(4600,7))
check('callback-overlay rounded price',ceil(F(4600,7)),658)
check('technician paid hours',2*30,60)
check('technician new-work hours',60-6-12-6,36)
check('technician three-hour jobs',F(36,3),12)
check('changed travel jobs',F(60-6-18-6,3),10)
check('original twelve-job review minutes',12*20,240)
check('original review job ceiling',180//20,9)
check('mixed review minutes',6*10+6*20,180)
obligations=5000+3000;retained=2000+1000+4000
check('immediate obligations',obligations,8000)
check('distinct retained reserves and floor',retained,7000)
room=18000-obligations-retained
check('base cash planning room',room,3000)
check('after3000withdrawal and obligations',18000-room-obligations,retained)
check('after4000withdrawal and obligations',18000-4000-obligations,6000)
check('4000withdrawal shortfall to retained amount',retained-(18000-4000-obligations),1000)
check('additional2000obligation scenario room',room-2000,1000)
profit=10000-6000
check('separate accrual profit',profit,4000)
cash=profit+1000-3000+1000
check('indirect operating cash',cash,3000)
check('direct operating cash',7000-4000,cash)
check('net change after equipment and principal',cash-2000-1000,0)
check('continuity uncovered hours',18-12,6)
check('conditional additional continuity cost',6*75,450)
check('changed backup gap',18-9,9)
normalized=120000-80000
check('annual earnings after replacement work',normalized,40000)
check('illustrative normalized multiple result',3*normalized,120000)
check('incorrect unadjusted multiple result',3*120000,360000)
check('changed replacement100000 earnings',120000-100000,20000)
print(json.dumps(dict(passed=True,checks=checks,scope='Exact rational synthetic arithmetic only; no actual market quote, legal distribution permission, worker classification, professional approval or valuation opinion.'),indent=2))

Related chapters