1 Task

Write a file named bmr.py with a function named st_jeor which, if given (mass, height, age, sex), returns Mifflin St Jeor estimate of the basal metabolic rate, an estimate of the Calories consumed to keep the body alive. Assume mass is given in kilograms, height in centimeters, age in years, and sex is either "male" or "female".

In the formula

Formula from Wikipedia
Formula from Wikipedia

s is +5 if sex is "male" and −161 if it is "female"; m, h, and a represent mass, height, and age respectively.

2 Example Invocations

When you run bmr.py, nothing should happen. It defines a function, it does not run it.

If in another file (which you do not submit) you write the following:

import bmr

print(bmr.st_jeor(74.7, 162.9, 19, 'female'))

you should get the following output:


3 Thought Question

Consider adding the other formulas listed in Wikipedia: harris_benedict, revised_harris_benedict, and katch_mcardle (katch_mcardle will require a body fat percentage estimate. How much do they differ?

4 Troubleshooting

The unit multipliers in the equation all cancel out; you can ignore them.

Have you tried other cases besides (74.7, 162.9, 19, 'female')? To know you got them right, try changing one argument at a time and see if it creates the expected size change in the output; for example, adding 10 kg should add 100 Calories.