Making a Purchase - Apple returns 0 instead of 2


#1



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


An error message appears saying: "compute_bill(['apple']) returned 0 instead of 2"


It should return 2.


def compute_bill(food):
    total = 0
    for item in food:
        total == total + prices[item]
    return total


#2

== is for comparison. = is for assigning variables to something.


#3

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