1viktors_ingredients = [ "чушки", "домати", "моркови", "ябълки", "сол", "черен пипер", "кимион", "зехтин"]
2georgis_ingredients = ("чушки", "домати", "патладжан", "люти чушки", "олио", "захар", "чубрица",
3 "черен пипер", "врачанска ракия")
4
5shopping_list = viktors_ingredients + list(georgis_ingredients)
6shopping_list.reverse()
7
8unique_ingredients = set()
9
10"""for each_ingredient in shopping_list:
11 if each_ingredient not in unique_ingredients:
12 unique_ingredients.add(each_ingredient)
13 """
14#we can add all the items without checking, because set removes the duplicates
15for each_ingredient in shopping_list:
16 unique_ingredients.add(each_ingredient)
17
18#print(unique_ingredients)
19
20ingredient_quantities = {}
21
22for unique_ingredient in unique_ingredients:
23 ingredient_quantities[unique_ingredient] = 5
24
25
26ingredient_quantities["skyr"] = 1
27
28#for each_ingredient in ingredient_quantities:
29# print(each_ingredient, ingredient_quantities[each_ingredient], '\n')
30
31number_of_ingredients_to_buy = len(ingredient_quantities)
........
----------------------------------------------------------------------
Ran 8 tests in 0.000s
OK
14.10.2024 11:33