Fitness is Important for everyone. Children and adults of all ages need regular physical activity. Physical activity promotes good health, and you can be always active at any age. Let write python scripts to help them to calculate their bodyfat percentage. Bodyfat Percentage can be calculated with skinfold measurements (Calipers). Caliper is a device in which you can measure skin folds of triceps, biceps, suprailiac, thigh, and puts those measurements into a formula.
We are going to use the fitness-tools module to calculate body fat percentage. Before starting we need to install the fitness-tools module:
This module does not come built int with Python. To install this type the below command in the terminal.
pip install fitness-tools
Consider a 25-year-old female whose skinfold measurements in millimeters are:
triceps = 5 biceps = 7 thigh = 8 suprailliac = 12
- Import module
- pass the following arguments to DurninWomersley(Age, Sex, Askinfold measurements)
- Get body density value with body_density()
- Get bodyfat with siri()
Below is the implementation:
Get the body fat
Note: According to the Durnin Womersley equation, our hypothetical female’s body fat is 20.5%.
Method 2: We can use JacksonPollock4Site class to get direct data from the given measurement.
Note: According to the JacksonPollock4Site equation, the hypothetical male has a body fat percent of 5.2%.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.