Apr-29-2022, 11:02 PM
(Apr-29-2022, 10:12 PM)deanhystad Wrote: Where are you saving input? candy only reference the last input.
Why does output = candy_calories.get(cal, "!")? candy_calories values are all numbers. Why do you want to return a string if cal is not a key in the dictionary?
Python has a built in function that will give you the sum of a list of numbers.
That's what I'm trying to figure out. What would be the correct way to save the input for the number of total pieces of candy consumed so that I can later add them up for total calories?
Is output = candy_calories.get (cal, "!") converting to a string? I thought it was just grabbing the values of the dictionary entries.