Joseph D. Sloan
sloanjd @ wofford.edu
while <test>: #body
Infinite Loops—if the test is always true, the loop won't terminate. With the interpreter, use a control-C. Here is an example of an infinite loop:
while true: print "hello"
Usually the problem with the test is more subtle. And, at times, infinite loops are useful.
Definite -> indefinite (yes)
Indefinite -> definite (maybe)
while True: ... if ...: break ...
Add comments to your Energy Density calculator as described below. You should also check input values to insure that they are reasonable. Be sure to correct any existing problems as well including documentation. Submit the code as an email attachment.
Assuming you are trying to lose weight:
If ED is between 0 and 0.6, it is very low and you can eat the food without restraint;
If ED is between 0.6 and 1.5, it is low and you can eat with minor restraints;
If ED is between 1.5 and 4.0, it is medium and you should watch portions;
If ED is between 4.0 and 9.0, it is high and you should closely limit or avoid the food.
Alter your GUI so that it prints appropriate comments based on this information.