I am trying to write a program that calculates nutrition level in food.Suppose I have this data(may be incorrect)
10 grams of bread has 68 mg sodium.
1 medium slice is 50 grams.
1 cup of milk has 98 mg sodium
1 cup of milk is 236 ml(or 244 grams)
which means 10 grams of milk has 0.004 grams of Sodium
The user may enter number of slices or grams of bread he ate or if it is milk -how many cups or how many ml of milk he drank
So,how should I design the data structure? should I keep a single unit measure internally like grams and convert slice,ml,cup etc into that?
food details ={
'whitebread':{'unit':10,'slice':50,'sodium':0.068},
'milk':{'unit':10,'cup':244,'sodium':0.004},...
}