Question: Programming Practice 5.4: Calories by Macronutrient 20 pts Not Submitted Due Feb 23, 2020 at 11:59 PM Submission Types Website URL Submission & Rubric Description




Programming Practice 5.4: Calories by Macronutrient 20 pts Not Submitted Due Feb 23, 2020 at 11:59 PM Submission Types Website URL Submission & Rubric Description Lesson Objective(s): Using Functions Returning values from functions and storing them in variables Lesson: A nutritionist who works for a fitness club helps members by evaluating their diets. As part of her evaluation, she asks members for the number of fat grams, carbohydrate grams, and protein grams that they consumed in a day. Then, she calculates the number of calories that result from the fat, using the following formula: calories from fat = fat grams X 9 Next, she calculates the number of calories that result from the carbohydrates, using the following formula: calories from carbs = carb grams X 4 Next, she calculates the number of calories that result from the proteins, using the following formula: calories from protein = protein grams X 4 Use a different function for each nutrient to make calculations by nutrient, and print the calories for that nutrient on screen. Return the results from each function to variables in the main method. Add the variables in the main method to display the total calories for the day. Use meaningful names for each variable and function. Add a comment to each function describing what it does. Assignment Requirements: Upload your .py file to Git Hub and submit the link to that file. Don't forget to use meaningful names for variables and functions, and to use comments describing the purpose of each function. Sample Results: How many grams of fat did you eat today You ate 900 calories from fat today. How many grams of carbs did you eat tod You ate 400 calories from carbs today. How many grams of protein did you eat t You ate 400 calories from protein today You ate a total of 1,700 calories today esults: grams of fat did you eat today? 100 900 calories from fat today. grams of carbs did you eat today? 100 400 calories from carbs today. grams of protein did you eat today? 100 400 calories from protein today. a total of 1,700 calories today
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
