1viktors_ingredients = ['чушки', 'домати', 'моркови', 'ябълки', 'сол', 'черен пипер', 'кимион', 'зехтин']
2georgis_ingredients = ('чушки', 'домати', 'патладжан', 'люти чушки', 'олио', 'захар', 'чубрица', 'черен пипер', 'врачанска ракия')
3
4shopping_list = viktors_ingredients + list(georgis_ingredients)
5shopping_list.reverse()
6
7unique_ingredients = list(set(shopping_list))
8
9ingredient_quantities = {ingredient: 5 for ingredient in unique_ingredients}
10
11ingredient_quantities['skyr'] = 1
12
13number_of_ingredients_to_buy = len(ingredient_quantities)
........
----------------------------------------------------------------------
Ran 8 tests in 0.000s
OK
![]()
Станислава Желязкова
13.10.2024 21:05Разбирам, ще го поправя и ще кача новото решение. :)
|
f | 1 | viktors_ingredients = ['чушки', 'домати', 'моркови', 'ябълки', 'сол', 'черен пипер', 'кимион', 'зехтин'] | f | 1 | viktors_ingredients = ['чушки', 'домати', 'моркови', 'ябълки', 'сол', 'черен пипер', 'кимион', 'зехтин'] |
2 | georgis_ingredients = ('чушки', 'домати', 'патладжан', 'люти чушки', 'олио', 'захар', 'чубрица', 'черен пипер', 'врачанска ракия') | 2 | georgis_ingredients = ('чушки', 'домати', 'патладжан', 'люти чушки', 'олио', 'захар', 'чубрица', 'черен пипер', 'врачанска ракия') | ||
3 | 3 | ||||
n | 4 | shopping_list = list(viktors_ingredients) + list(georgis_ingredients) | n | 4 | shopping_list = viktors_ingredients + list(georgis_ingredients) |
5 | shopping_list.reverse() | 5 | shopping_list.reverse() | ||
6 | 6 | ||||
7 | unique_ingredients = list(set(shopping_list)) | 7 | unique_ingredients = list(set(shopping_list)) | ||
8 | 8 | ||||
9 | ingredient_quantities = {ingredient: 5 for ingredient in unique_ingredients} | 9 | ingredient_quantities = {ingredient: 5 for ingredient in unique_ingredients} | ||
10 | 10 | ||||
11 | ingredient_quantities['skyr'] = 1 | 11 | ingredient_quantities['skyr'] = 1 | ||
12 | 12 | ||||
13 | number_of_ingredients_to_buy = len(ingredient_quantities) | 13 | number_of_ingredients_to_buy = len(ingredient_quantities) | ||
t | t | 14 | |||
15 | |||||
16 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|