Why is compute_bill returning the wrong value?


that could work, but you would need to check all keys in prices dictionary

personally, i would just use .get() which returns None when the key is not in dictionary


we havent learned that yet… :frowning:


then do what i mentioned first, which would use a loop + condition. Codecademy doesn’t teach every method in existence, if it hasn’t been taught, just check documentation.


item is just an identifier, not a string literal. It refers to a string literal, one of the items in the food list.

The only error that will occur is KeyError if the item is not found in the keys list of the prices dictionary.


Hi this whole lesson is confusing, please pay attention to what people are telling you and change it.