Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAMy solution.
I use another API(https://fdc.nal.usda.gov/api-guide.html ) by DEMO_KEY.
But downloaded data don't have calories of the Snickers.
Like others, I had to revise provided IDs. Otherwise, seemed straightforward enough. Pleased that I was able to keep the tool count low.
Thank you to @mpennington for the updated IDs. Attached is my solution.
Here is my submission; I spend a long time looking for the NDB ID, but then I realised that it is from the old system, then the only way is to use the search parameter and pick the first one from each candy, the total calories is slightly less than the answer. But I think the logic is correct. Also, the calories are per 100g, not per bag that shows from the website.
It's all about find the correct api call now.
Used: https://fdc.nal.usda.gov/api-guide.html#bkmk-1
Got reasonable close to the answer