anschelburk / nutrient_guide

Apache License 2.0
0 stars 0 forks source link

dailyvalues_blank seems redundant, we can derive it from the daily_values dict #40

Closed bbelderbos closed 8 months ago

bbelderbos commented 8 months ago

Using a dict comprehension (love Python!), e.g.

>>> daily_values = {
...     "Added sugars": {"value": 50, "unit": "g"},
...     "Biotin": {"value": 30, "unit": "mcg"},
... }
>>> daily_values = {key: {"value": 0, "unit": value["unit"]} for key, value in daily_values.items()}
>>> daily_values
{'Added sugars': {'value': 0, 'unit': 'g'}, 'Biotin': {'value': 0, 'unit': 'mcg'}}
anschelburk commented 8 months ago

Done. Can be found in the following branch: combined_nutrients_dict