Something up with my for statement?


#1



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):#adds total prices of all items to total
total = 0#sets value of total to zero
for pieces in food:#adds value of each item in prices to total
total += prices[pieces]
return total


https://www.codecademy.com/en/courses/python-beginner-en-IZ9Ra/2/2?curriculum_id=4f89dab3d788890003000096


My for loops doesn't iterate though my entire prices list.


Replace this line with your code.


#2

Your posted code is not formatted, so we cannot see its indentation. However, the problem you have reported suggests that you need to check whether the indentation that you do have is correct.


#3

That fixed it! Thanks so much:)


#4