# A Day at the Supermarket-Let's Check Out! help please!

#1

Hello world again! I still coding and I finally have this code but at the last part of the exercise asking to :(Print your result and click Run to finish this course.), I put this code: print compute_bill(shopping_list) and it return the result 5.5 in the console, if it’s OK, why 5.5? If not how to print the result?

shopping_list = [“banana”, “orange”, “apple”]

stock = {
“banana”: 6,
“apple”: 0,
“orange”: 32,
“pear”: 15
}

prices = {
“banana”: 4,
“apple”: 2,
“orange”: 1.5,
“pear”: 3
}

def compute_bill(food):
total = 0
for item in food:
if stock[item] > 0:
total += prices[item]
stock[item] -= 1

print compute_bill(shopping_list)

#2

you buy one apple, one banana and one orange (shopping list), this is 5.5 (4 for a banana, and 1.5 for the orange, and there are no apples in store)

#3

Well! so it prints out the total price. I got it clear now.
Thanks a lot stetim94

#4

that is why the function is named compute bill its computing the bill (total price of checkout), you could test it with different lists (representing different customers/checkouts)

#5

That’s cool thanks dear friend.
I always try to understand the English word “compute” since I am from a French country.