Skip to content
Tutorials Center
My learning

Topics

Lesson 35 of 37 · Projects and Practice

Project: Health Calculators

Build calculators for BMI, resting energy use, heart rate zones and daily water intake, and learn what each number can and cannot tell you.

In this project you will turn formulas from human biology into small, reusable calculators: body mass index, resting energy use, heart rate zones and a body-temperature converter. Each one shows how a simple number summarizes something about the body. Just as important, you will see what each number cannot tell you.

These tools are for learning. They give rough estimates for groups of people, not medical advice. For health questions, talk to a doctor or other health professional.

Calculator 1: body mass index (BMI)

BMI = mass (kg) / height (m)²

For adults, common categories from the World Health Organization are: under 18.5 (underweight), 18.5 to 24.9 (healthy range), 25 to 29.9 (overweight), 30 and above (obesity). BMI is a screening tool. It does not measure body fat directly, and it can mislead for very muscular people, for older adults, and for some ethnic groups. It does not apply to children, who use age-specific charts.

Python BMI calculator

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Calculator 2: resting energy use (BMR)

Your basal metabolic rate (BMR) is the energy your body uses at complete rest. One widely used estimate is the Mifflin-St Jeor equation, with mass in kg, height in cm and age in years:

  • Males: BMR = 10 × mass + 6.25 × height - 5 × age + 5
  • Females: BMR = 10 × mass + 6.25 × height - 5 × age - 161

The result is in kilocalories (kcal) per day. To convert to kilojoules, multiply by 4.184. A person's actual energy needs are higher than BMR because of daily activity, so BMR is often multiplied by an activity factor of about 1.2 (very little exercise) to 1.9 (very active).

Python BMR and daily energy estimate

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Calculator 3: heart rate zones

Your heart rate is how many times your heart beats per minute (bpm). A common rough estimate of maximum heart rate is 220 - age. A more recent formula is 208 - 0.7 × age. Both are averages with wide individual variation, so treat them as rough guides. Exercise intensity is often described as a percentage of this maximum: for example, moderate exercise at about 50 to 70 % and vigorous at about 70 to 85 %.

You can also measure your resting heart rate by counting beats for 30 seconds and doubling. For most healthy adults it lies between about 60 and 100 bpm, and is often lower in very fit people.

Python Heart rate zones

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Calculator 4: temperature and fever

Normal core body temperature is about 37 °C. A temperature of 38 °C or above is usually regarded as a fever. Converting with F = C × 9/5 + 32 is useful when reading thermometers from other countries.

Python Temperature check

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Extend the project

Ideas to try:

  1. Combine the calculators in one function that takes a person's details and prints a summary.
  2. Add a daily water estimate in a clearly labelled way (many guides suggest roughly 2 to 3 litres of total fluid per day for adults, but needs depend on climate and activity).
  3. Plot heart rate zones against age from 10 to 80 with matplotlib.
  4. Write a short note explaining each calculator's limits.

Related lessons: Homeostasis and Feedback Loops, The Kidneys and Water Balance.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is the BMI of a person with mass 64 kg and height 1.60 m?

    BMI = 64 / 1.60² = 64 / 2.56 = 25.
  2. 2. What does BMR measure?

    Basal metabolic rate is the energy used to keep the body running at rest.
  3. 3. Using 220 - age, what is the estimated maximum heart rate of a 20-year-old?

    220 - 20 = 200 bpm, a rough average that varies between people.
  4. 4. Why should these calculators be used carefully?

    Formulas describe averages. Individual health needs a professional's assessment.

Summary

  • BMI = mass / height²; BMR estimates energy used at rest; heart rate zones use a percentage of an estimated maximum.
  • A fever is usually 38 °C or higher; core temperature is about 37 °C.
  • Formulas give rough estimates for groups, not diagnoses for individuals.

Next: Practice Set: Control and Communication