Problem with printing the TOTAL (STOCKING OUT)


Hi Pals,

I need small clarification.Why am I not getting the output TOTAL in the console window even I have finished that assignment properly.

In the below given program, I have tried in two way like having 1)both the "return" and "print" statement together, 2)"print" command alone as given below.But,still not getting the total in the screen.

shopping_list = ["banana", "orange", "apple"]

stock = {
    "banana": 6,
    "apple": 0,
    "orange": 32,
    "pear": 15
prices = {
    "banana": 4,
    "apple": 2,
    "orange": 1.5,
    "pear": 3

# Write your code below!
def compute_bill(food):
    for item in food:
        if stock[item]>0:
    #return total
    print total



Hello :slight_smile:

You have to call / execute your function. To do that you need to pass some value as a food parameter. Example:



@factoradic Thank you very much!
I made that last line into comment...lolzzz...


You're very welcome :slight_smile:


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