The American Heart Association (AHA) suggests that at most 30% of the calories in our diet come from fat. Although food labels give the number of calories and the amount of fat per serving, they often do not give the percentage of calories from fat. This percentage can be calculated by multiplying the number of grams of fat in one serving by 9, dividing that number by the total number of calories per serving, and multiplying the result by 100.
Write a Python 3 program that requests the name of the food, number of calories per serving, and the number of grams of fat per serving as input, and tells us whether or not the food meets the American Heart Association recommendation.
For example, if the user inputs:
Low fat milk
120
5
the program should output:
Low fat milk contains 37.5 % calories from fat.
Low fat milk exceeds the AHA recommendation of 30% calories from fat.
Example program runs:
Input (what the user types in) is shown in bold black font.
Output is shown in blue font.
Example run #1:
Program to calculate
the percentage of calories from fat in the diet.
Please enter the name of the food: Low fat milk
Please enter the number of calories per serving: 120
Please enter the grams of fat per serving: 5
RESULTS
Low fat milk contains 37.50% calories from fat.
Low fat milk exceeds the AHA recommendation.
Example run #2:
Program to calculate
the percentage of calories from fat in the diet.
Please enter the name of the food: crispbread
Please enter the number of calories per serving: 100
Please enter the grams of fat per serving:0.5
RESULTS
crispbread contains 4.5 % calories from fat
crispbread is within the AHA recommendation of 30% calories from fat.