Why print something like that?


#1


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

This code prints:
117.0
None

I just want to ask why it prints 117.0. I know that that is the total of 'stock multiplied to prices' but I did not do anything in the code to print something like that. Thanks!


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

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):
    total = 0
    for item in food:
        total = total + prices[item]
       
    return total


#2

Hi @dssop,

My copy of your code did not display 117.0. Try refreshing the page and submitting the same code again.


#3

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