A good diet is an integral aspect of a balanced lifestyle. It defines the well-being of a human being. Nutrients are divided into two categories i.e macronutrients and micronutrients. Macronutrients are the nutrition that the body needs a large amount. Macronutrients provide calories or energy on the other hand micronutrients are those nutrients that the body requires in smaller doses like Calcium, Potassium, Sodium, Iron, Zinc, etc.
In this article, we are going to write python scripts to get Macronutrient information from the given data.
We are going to use the fitness_tools module to calculate Macronutrient compounds. The goal of this package is to automate these calculations so you can spend more time following through with your nutrition plan.
pip install fitness-tools
Let’s understand this module with implementation:
The make_meal() class method returns a dictionary of recommended calories and macronutrients for a meal based on your input and passing int through the function.
fitness_tools.meals.meal_maker.MakeMeal(weight, goal=None, body_type=None, activity_level=None, min_cal=None, max_cal=None, fat_percent=None, protein_percent=None, carb_percent=None)
- weight: Enter your current weight.
- goal: Select a goal, ‘weight_loss’, ‘maintenance’, ‘weight_gain’, or None.
- body_type: Select a body type: ‘endomorph’, ‘ectomorph’, ‘mesomorph’ or None.
- activity_level: Select an activity level, ‘sedentary’, ‘moderate’, ‘very’,
- min_cal: Enter the desired minimum calories per pound defaults to None.
- max_cal: Enter the desired maximum calories per pound defaults to None.
- fat_percent: Enter the desired percent of calories from fat defaults to None.
- protein_percent: Enter the desired percent of calories from protein defaults
- carb_percent: Enter the desired percent of calories from carbohydrates
defaults to None.
Below are some programs which implement the use fitness_tools module for Macronutrient analysis:
Get the Macronutrient with daily_requirements() method.
Get macronutrient percentages and calorie ranges manually.
Note: The sum of fat_percent(), protein_percent(), and carb_percent() must be equal to 1.
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.