[Tutor] Which should it be, lists, tuples, dictionary or files?
Ken G.
beachkidken at gmail.com
Mon Jan 2 23:00:47 CET 2012
I have been using an Open Office Spreadsheet containing basically, the
food name, basic serving amount, calories, sodium and carbohydrate.
Daily, I entered the servicing amount being eaten and its calculate the
amount of calories, sodium and carbohydrate. For some odd reason, I
kept losing the spreadsheet and its data.
I am interested in keeping track of the number of calories consumed each
day. Due to losing the spreadsheet data so frequencies, I decided to
use Python in keeping track of the basic information and perhaps, keep
track of the calories in a file.
Over the last several months, numerous mention is made of lists, tuples
and dictionary here. Basically, the format will be as follow:
Name of Food
Basic Serving Amount
Calories per serving
Sodium per serving
Carbohydrate per serving
For example,
Name: Hominy, Golden (3.5)
Serving Size: 1/2 cup
Calories: 100
Sodium: 380
Carbohydrate: 20
The '(3.5)' indicated above is number of servings in a 15.5-ounce can.
It will not necessary be indicated.
Should the above five elements be stored as a list, tuples, dictionary
or file? I am will familiar with files and have some knowledge of using
lists and tuples. Not too familiar with dictionary.
Thank for any suggestion.
Ken
More information about the Tutor
mailing list