Making a purchase help


#1

def compute_bill(food):
total = 0
for item in food:
total += prices[item]
return total
Oops, try again. compute_bill(['banana', 'apple', 'orange', 'pear']) returned 4 instead of 10.5
help please I cnat find a way


#2

a function ends the moment a return keyword is reached

so your function ends in the first iteration of the loop


#3

so how do I fix the code


#4

don't make your function end in the first iteration of the loop


#5

how do I not make it end in the first iteration


#6

by placing return outside the loop, since that is what ends the function


#7

thank you so much it helped


#8