Une journée au supermarché


#1



Une journée au supermarché

Working code **Frensh version :


#  by jslearn16  _I hope that will be helpfull_ Have a nice day!
#  ps: I have add somethings for more detail.

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(courses):
    n=0
    for x in courses:
        if stock[x] >= 1:
            print "current article : ",x
            print "Price : ",prix[x]
            n += prix[x]
            stock[x] -= 1
        else:
            print x," is not available in stock!"
    print " Total price of purchase : "+str(n)
    return n
        
calculer_facture(courses)


#2

think this should work. What is error?


#3

there is no error ! I have said working code !!


#4

think there is no need to post working code, also think it's against community faq


#5

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 calcul_facture(x):
n=0
for x in courses:
if stock[x] >0:
print "current article : ",x
print "Price : “,prix[x]
n += prix[x]
stock[x] = -1
else:
print x,” is not available in stock!"
print " Total price of purchase : "+str(n)
return n
celui la marche, je me suis basé sur le tien pour le transformer et qu’il fonctionne.