Python Pharma Lab · free pilot
Drug level simulator
Write real Python in your browser — even on your phone — and watch what happens to the drug level in the blood when a patient gets an injection every 8 hours.
The pharmacy problem
A patient receives 500 mg of a drug by IV injection every 8 hours. The drug has a half-life of 6 hours and a volume of distribution of 40 L. What happens to the drug level over 2 days — and what if a dose is missed?
What you need
- Elimination rate constant: k = ln(2) ÷ half-life
- Level left from one dose after time t: (dose ÷ V) × e−k·t
- With repeated doses, the levels from every dose add up.
Teaching values for an imaginary drug, using the one-compartment IV bolus model. Not a real drug and not clinical advice.