1viktors_ingredients = [
2 "чушки", "домати", "моркови", "ябълки",
3 "сол", "черен пипер", "кимион", "зехтин"
4]
5
6georgis_ingredients = (
7 "чушки", "домати", "патладжан", "люти чушки",
8 "олио", "захар", "чубрица", "черен пипер", "врачанска ракия"
9)
10
11shopping_list = viktors_ingredients + list(georgis_ingredients)
12shopping_list.reverse()
13
14unique_ingredients = set(shopping_list)
15
16ingredient_quantities = dict.fromkeys(unique_ingredients, 5)
17ingredient_quantities["skyr"] = 1
18
19number_of_ingredients_to_buy = len(ingredient_quantities)
........
----------------------------------------------------------------------
Ran 8 tests in 0.000s
OK
Виктор Бечев
11.10.2024 15:41Не, не трябва да е на кирилица. :smile:
|
| f | 1 | viktors_ingredients = [ | f | 1 | viktors_ingredients = [ |
| n | 2 | "peppers", "tomatoes", "carrots", "apples", | n | 2 | "чушки", "домати", "моркови", "ябълки", |
| 3 | "salt", "black pepper", "cumin", "olive oil" | 3 | "сол", "черен пипер", "кимион", "зехтин" | ||
| 4 | ] | 4 | ] | ||
| 5 | 5 | ||||
| 6 | georgis_ingredients = ( | 6 | georgis_ingredients = ( | ||
| n | 7 | "peppers", "tomatoes", "eggplant", "hot peppers", | n | 7 | "чушки", "домати", "патладжан", "люти чушки", |
| 8 | "oil", "sugar", "savory", "black pepper", "vratsa rakia" | 8 | "олио", "захар", "чубрица", "черен пипер", "врачанска ракия" | ||
| 9 | ) | 9 | ) | ||
| 10 | 10 | ||||
| 11 | shopping_list = viktors_ingredients + list(georgis_ingredients) | 11 | shopping_list = viktors_ingredients + list(georgis_ingredients) | ||
| 12 | shopping_list.reverse() | 12 | shopping_list.reverse() | ||
| 13 | 13 | ||||
| 14 | unique_ingredients = set(shopping_list) | 14 | unique_ingredients = set(shopping_list) | ||
| 15 | 15 | ||||
| 16 | ingredient_quantities = dict.fromkeys(unique_ingredients, 5) | 16 | ingredient_quantities = dict.fromkeys(unique_ingredients, 5) | ||
| 17 | ingredient_quantities["skyr"] = 1 | 17 | ingredient_quantities["skyr"] = 1 | ||
| 18 | 18 | ||||
| 19 | number_of_ingredients_to_buy = len(ingredient_quantities) | 19 | number_of_ingredients_to_buy = len(ingredient_quantities) | ||
| t | 20 | t | |||
| 21 | print("Viktor's ingredients list:", viktors_ingredients) | ||||
| 22 | print("Georgi's ingredients tuple:", georgis_ingredients) | ||||
| 23 | print("Reversed shopping list:", shopping_list) | ||||
| 24 | print("Unique ingredients:", unique_ingredients) | ||||
| 25 | print("Ingredient quantities:", ingredient_quantities) | ||||
| 26 | print("Number of ingredients to buy:", number_of_ingredients_to_buy) |
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||
| f | 1 | viktors_ingredients = [ | f | 1 | viktors_ingredients = [ |
| 2 | "peppers", "tomatoes", "carrots", "apples", | 2 | "peppers", "tomatoes", "carrots", "apples", | ||
| 3 | "salt", "black pepper", "cumin", "olive oil" | 3 | "salt", "black pepper", "cumin", "olive oil" | ||
| 4 | ] | 4 | ] | ||
| 5 | 5 | ||||
| 6 | georgis_ingredients = ( | 6 | georgis_ingredients = ( | ||
| 7 | "peppers", "tomatoes", "eggplant", "hot peppers", | 7 | "peppers", "tomatoes", "eggplant", "hot peppers", | ||
| 8 | "oil", "sugar", "savory", "black pepper", "vratsa rakia" | 8 | "oil", "sugar", "savory", "black pepper", "vratsa rakia" | ||
| 9 | ) | 9 | ) | ||
| 10 | 10 | ||||
| 11 | shopping_list = viktors_ingredients + list(georgis_ingredients) | 11 | shopping_list = viktors_ingredients + list(georgis_ingredients) | ||
| 12 | shopping_list.reverse() | 12 | shopping_list.reverse() | ||
| 13 | 13 | ||||
| 14 | unique_ingredients = set(shopping_list) | 14 | unique_ingredients = set(shopping_list) | ||
| 15 | 15 | ||||
| t | 16 | ingredient_quantities = {ingredient: 5 for ingredient in unique_ingredients} | t | 16 | ingredient_quantities = dict.fromkeys(unique_ingredients, 5) |
| 17 | ingredient_quantities["skyr"] = 1 | 17 | ingredient_quantities["skyr"] = 1 | ||
| 18 | 18 | ||||
| 19 | number_of_ingredients_to_buy = len(ingredient_quantities) | 19 | number_of_ingredients_to_buy = len(ingredient_quantities) | ||
| 20 | 20 | ||||
| 21 | print("Viktor's ingredients list:", viktors_ingredients) | 21 | print("Viktor's ingredients list:", viktors_ingredients) | ||
| 22 | print("Georgi's ingredients tuple:", georgis_ingredients) | 22 | print("Georgi's ingredients tuple:", georgis_ingredients) | ||
| 23 | print("Reversed shopping list:", shopping_list) | 23 | print("Reversed shopping list:", shopping_list) | ||
| 24 | print("Unique ingredients:", unique_ingredients) | 24 | print("Unique ingredients:", unique_ingredients) | ||
| 25 | print("Ingredient quantities:", ingredient_quantities) | 25 | print("Ingredient quantities:", ingredient_quantities) | ||
| 26 | print("Number of ingredients to buy:", number_of_ingredients_to_buy) | 26 | print("Number of ingredients to buy:", number_of_ingredients_to_buy) |
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||
| f | 1 | viktors_ingredients = [ | f | 1 | viktors_ingredients = [ |
| 2 | "peppers", "tomatoes", "carrots", "apples", | 2 | "peppers", "tomatoes", "carrots", "apples", | ||
| 3 | "salt", "black pepper", "cumin", "olive oil" | 3 | "salt", "black pepper", "cumin", "olive oil" | ||
| 4 | ] | 4 | ] | ||
| 5 | 5 | ||||
| 6 | georgis_ingredients = ( | 6 | georgis_ingredients = ( | ||
| 7 | "peppers", "tomatoes", "eggplant", "hot peppers", | 7 | "peppers", "tomatoes", "eggplant", "hot peppers", | ||
| 8 | "oil", "sugar", "savory", "black pepper", "vratsa rakia" | 8 | "oil", "sugar", "savory", "black pepper", "vratsa rakia" | ||
| 9 | ) | 9 | ) | ||
| 10 | 10 | ||||
| 11 | shopping_list = viktors_ingredients + list(georgis_ingredients) | 11 | shopping_list = viktors_ingredients + list(georgis_ingredients) | ||
| t | 12 | shopping_list.sort() | t | ||
| 13 | shopping_list.reverse() | 12 | shopping_list.reverse() | ||
| 14 | 13 | ||||
| 15 | unique_ingredients = set(shopping_list) | 14 | unique_ingredients = set(shopping_list) | ||
| 16 | 15 | ||||
| 17 | ingredient_quantities = {ingredient: 5 for ingredient in unique_ingredients} | 16 | ingredient_quantities = {ingredient: 5 for ingredient in unique_ingredients} | ||
| 18 | ingredient_quantities["skyr"] = 1 | 17 | ingredient_quantities["skyr"] = 1 | ||
| 19 | 18 | ||||
| 20 | number_of_ingredients_to_buy = len(ingredient_quantities) | 19 | number_of_ingredients_to_buy = len(ingredient_quantities) | ||
| 21 | 20 | ||||
| 22 | print("Viktor's ingredients list:", viktors_ingredients) | 21 | print("Viktor's ingredients list:", viktors_ingredients) | ||
| 23 | print("Georgi's ingredients tuple:", georgis_ingredients) | 22 | print("Georgi's ingredients tuple:", georgis_ingredients) | ||
| 24 | print("Reversed shopping list:", shopping_list) | 23 | print("Reversed shopping list:", shopping_list) | ||
| 25 | print("Unique ingredients:", unique_ingredients) | 24 | print("Unique ingredients:", unique_ingredients) | ||
| 26 | print("Ingredient quantities:", ingredient_quantities) | 25 | print("Ingredient quantities:", ingredient_quantities) | ||
| 27 | print("Number of ingredients to buy:", number_of_ingredients_to_buy) | 26 | print("Number of ingredients to buy:", number_of_ingredients_to_buy) |
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||