Making a purchase code error


#1

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

Getting the error message :Oops, try again. compute_bill(['apple']) resulted in a TypeError: list indices must be integers, not str


#2

@debojit take a look at this post to know why you get the error
Click here to post