Oops, try again. compute_bill(['apple']) resulted in a TypeError: unsupported operand type(s) for +: 'int' and 'str'
We're forced to guess what your problem is. You do realize that, right? Next time please provide some information that will help us quickly solve your problem or rather help you to solve your problem.
We've seen cases such as this,
def compute_bill(food): total = 0 for item in food: total += item return total
This returns an error similar to the above. The way to repair this is to see that
item is a string, and we cannot add a string to a number. What we need is the value in the
prices dictionary that corresponds with the key of the same name as
total += prices[item]
This may be your problem. But, as earlier stated, it's just a guess.
- A link to the exercise
- Your attempted code
- The error messages