This tutorial provides a user-friendly guide to mathematically formulating constrained optimization problems and implementing them using Python.Two examples are presented to illustrate how constrained optimization is used in health applications, with accompanying Python code provided.