Wats wrongg//////////////?


#1


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):
total=0
for prices['banana','orange','apple'] in food:
total +=prices['banana','orange','apple']
return total


Replace this line with your code.


#2

def compute_bill(food):
total=0
for prices['banana','orange','apple'] in food:
total +=prices['banana','orange','apple']
return total

so when you write --> :
you have to make everything after that 'tabbed'

def compute_bill(food):
         total=0
         for prices['banana','orange','apple'] in food:
               total +=prices['banana','orange','apple']
         return total

lastly in that code you used

def compute_bill(food):

but after that you kinda abandon food...

total +=prices['banana','orange','apple']

so it's better to keep food, because it's a placeholder

def compute_bill(food):
    total=0
    for instert_anything_here in food
        total += insert_anything_here
return total

#3

so wat should i do abt food?


#4

when you use 'shopping list' it will replace 'food'

print compute_bill(shopping_list)


#5

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