What is wrong?


#1

The instructions were:

Define a function compute_bill that takes one argument food as input.

In the function, create a variable total with an initial value of zero.

For each item in the food list, add the price of that item to total.

Finally, return the total.

I wrote this:

def compute_bill(food):
total = 0
for compra in food:
total += compra
return total

WHat did i do wrong?


#2

Look here:

Did you read this part of the instructions?:

For each item in the food list, add the price of that item to total.

Currently, your adding a string to an integer… That won’t work. We need to add the key of our items to total. Do you know what to do now? :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.