Why is compute_bill returning the wrong value?


#21

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


#22

we havent learned that yet… :frowning:


#23

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.


#24

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.


#25

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