# Code "partially" working, but mistaken

#1

Hi. My solution to this exercise doesn't work according to the site.

Here is the code:

courses = ["banane", "orange", "pomme"]

stock = { "banane": 6,
"pomme": 0,
"orange": 32,
"poire": 15
}

prix = { "banane": 4,
"pomme": 2,
"orange": 1.5,
"poire": 3
}

# Ecrivez votre code ci-dessous :

def calculer_facture(nourriture):
total=0
print total
for i in courses:
total += prix[i]
print total

calculer_facture(courses)

The console doesn't report any problem. In fact, it returns the intended values:

0
4
5.5
7.5
None

But the "teacher" tells me:
"Oups, merci de rÃ©essayer. Votre code ne fonctionne pas pour ['pomme'], il retourne None au lieu de 2."
Translation: "Oops, please retry. Your code doesn't work for ['pomme'], it returns None in place of 2."

I don't understand. Is that a bug, or is there a great misunderstanding from my part?

#2

I did the same thing and it dosen't work for me either Dx

courses = ["banane", "orange", "pomme"]

stock = { "banane": 6,
"pomme": 0,
"orange": 32,
"poire": 15
}

prix = { "banane": 4,
"pomme": 2,
"orange": 1.5,
"poire": 3
}

def calculer_facture(nourriture):
total = 0
for nourriture in courses:
total = total + prix[nourriture]
print total

calculer_facture(courses)

#4

Pour le moment, ne prenez pas en compte le stock.
what are you doing men?