Why can't I see the total cost?


#1

I wonder why in this list it only shows the first item in x. Can anyone explain, why it doesn’t show the total cost of the items listes in x, but only the first one(“orange: 2”?


#2

Why do you have two return statements?

you and the lesson have different ideas of what compute_bill should be capable of doing, the lesson assumes you pass a list (like shopping_list) as argument to function call, you use a dictionary


#3

oh, yeah I imported a piece of code and didn’t see the two return statements.
and you are right, I do use a dictionary… I am new to this and still get confused by the terms and mess it up. so what should I change? Or in other words: where do I see that the lesson assumes a list while I pass a dictionary? do i have to delete the list at the very top?


#4

at the function call, you could pass shopping_list as argument to function call

of course, its cool to make it work for both list and dictionary, but that is outside the scope of this exercise


#5

ah alright, thanks!
Yeah ur right. I just go to the next lesson. I will redo them anyways in order to see if i learned the lessons. my mind just wants to be able to do what I intended. :slight_smile:


#6

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