I have a list which could change of number of elements
list = ['sp', 'gb', 'fr']
And I have 3 dictionaries where i can find some information about each country.
dic_old_price = {'sp':3355, 'gb': 3000, 'fr':3500}
dic_new_price = {'sp':3005, 'gb': 2500, 'fr':3000}
dic_discount = {'sp': 0.20, 'gb': 0.15, 'fr':0.20}
Well, now I want make a condition if where value (old_price*dicount < new_price) then enter the loop, but it must be true for 3 countries (or all we have). Now, I have "if .... and .... and .... :" and I comment conditions if I have only 2 countries, but I can´t do that always.
if (dic_old_price[list[1]]*dic_discount[list[1]]) < dic_new_price[list[1]] and (dic_old_price[list[2]]*dic_discount[list[2]]) < dic_new_price[list[2]]: #and (dic_old_price[list[3]]*dic_discount[list[3]]) < dic_new_price[list[3]]:
... could be more than 3 countries...
How could I do that? thanks
Aucun commentaire:
Enregistrer un commentaire