adds 2025 materials
This commit is contained in:
commit
e85b3b21ca
23 changed files with 378 additions and 0 deletions
0
src/italianfood/__init__.py
Normal file
0
src/italianfood/__init__.py
Normal file
16
src/italianfood/dough.py
Normal file
16
src/italianfood/dough.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class PizzaDough:
|
||||
flour_weight: int
|
||||
water_weight: int
|
||||
salt_weight: int
|
||||
yeast_weight: int
|
||||
|
||||
def __init__(self, flour_weight, water_weight, salt_weight, yeast_weight):
|
||||
self.hydration = water_weight / flour_weight
|
||||
self.total_weight = flour_weight + water_weight + salt_weight + yeast_weight
|
||||
self.prepare_dough()
|
||||
|
||||
def prepare_dough(self):
|
||||
print("Kneading the dough. This will be delicious!\n...")
|
||||
|
||||
|
||||
|
||||
11
src/italianfood/drinks.py
Normal file
11
src/italianfood/drinks.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class Schorle:
|
||||
juice: str
|
||||
|
||||
def __init__(self, juice):
|
||||
self.name = f"{juice}schorle"
|
||||
|
||||
|
||||
def make_apfelschorle():
|
||||
print("Mixing a delicious Apfelschorle!\n...")
|
||||
apfelschorle = Schorle(juice="apple")
|
||||
return apfelschorle
|
||||
17
src/italianfood/ingredients_and_toppings.py
Normal file
17
src/italianfood/ingredients_and_toppings.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Dough ingredients
|
||||
FLOUR_PER_PIZZA = 250 # grams
|
||||
WATER_PER_PIZZA = 150 # grams
|
||||
SALT_PER_PIZZA = 5 # grams
|
||||
YEAST_PER_PIZZA = 2 # grams
|
||||
|
||||
# Toppings
|
||||
TOMATO_SAUCE = "tomato sauce"
|
||||
MOZZARELLA = "mozzarella"
|
||||
TOPPINGS_MARGARITA_PIZZA = [TOMATO_SAUCE, MOZZARELLA]
|
||||
TOPPINGS_FUNGHI_PIZZA = [TOMATO_SAUCE, MOZZARELLA, "mushrooms"]
|
||||
TOPPINGS_VERDURE_GRIGLIATE_PIZZA = [
|
||||
TOMATO_SAUCE,
|
||||
MOZZARELLA,
|
||||
"grilled vegetables"
|
||||
]
|
||||
|
||||
77
src/italianfood/make_pizza_refactored.py
Normal file
77
src/italianfood/make_pizza_refactored.py
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
from italianfood.dough import PizzaDough
|
||||
from italianfood.ovens import bake_pizza
|
||||
|
||||
STANDARD_FLOUR_WEIGHT = 180 # grams per pizza
|
||||
STANDARD_WATER_WEIGHT = 126 # grams per pizza
|
||||
STANDARD_SALT_WEIGHT = 2 # grams per pizza
|
||||
STANDARD_YEAST_WEIGHT = 1 # grams per pizza
|
||||
|
||||
MARGARITA_TOPPINGS = ["tomato sauce", "mozzarella cheese", "fresh basil"]
|
||||
MUSHROOM_TOPPINGS = ["tomato sauce", "mozzarella cheese", "mushrooms"]
|
||||
|
||||
|
||||
class Pizza:
|
||||
dough: PizzaDough
|
||||
num_pizzas: int = 1
|
||||
is_ready: bool = False
|
||||
|
||||
def __init__(self, dough, num_pizza_balls):
|
||||
if num_pizza_balls < 1:
|
||||
raise ValueError("Number of pizza balls must be at least 1.")
|
||||
self.num_pizzas = num_pizza_balls
|
||||
self.dough = dough
|
||||
self.make_pizza_balls()
|
||||
|
||||
def make_pizza_balls(self):
|
||||
self.weight_per_pizza_ball = self.dough.total_weight / self.num_pizzas
|
||||
print(
|
||||
f"Each Pizza will be made out of {self.weight_per_pizza_ball} g dough.\n..."
|
||||
)
|
||||
print("Now imagine expert pizza tossing skills!\n...")
|
||||
return self
|
||||
|
||||
def add_toppings(self, toppings):
|
||||
self.toppings = toppings
|
||||
print(f"Adding {self.toppings} to pizza(s).\n...")
|
||||
return self
|
||||
|
||||
|
||||
def make_margarita_pizza_more_readable(num_pizzas: int = 1):
|
||||
dough = make_pizza_dough(num_pizzas)
|
||||
baked_pizza = make_and_bake_pizza(dough, num_pizzas, MARGARITA_TOPPINGS)
|
||||
return baked_pizza
|
||||
|
||||
|
||||
def make_pizza_dough(num_pizzas: int = 1):
|
||||
dough = PizzaDough(
|
||||
flour_weight=STANDARD_FLOUR_WEIGHT * num_pizzas,
|
||||
water_weight=STANDARD_WATER_WEIGHT * num_pizzas,
|
||||
salt_weight=STANDARD_SALT_WEIGHT * num_pizzas,
|
||||
yeast_weight=STANDARD_YEAST_WEIGHT * num_pizzas,
|
||||
)
|
||||
return dough
|
||||
|
||||
|
||||
def make_and_bake_pizza(dough, num_pizzas, toppings):
|
||||
pizza = Pizza(dough=dough, num_pizza_balls=num_pizzas)
|
||||
pizza.add_toppings(toppings)
|
||||
baked_pizza = bake_pizza(pizza)
|
||||
return baked_pizza
|
||||
|
||||
|
||||
def make_pizza_reusable(num_pizzas, toppings):
|
||||
dough = make_pizza_dough(num_pizzas)
|
||||
baked_pizza = make_and_bake_pizza(dough, num_pizzas, toppings)
|
||||
return baked_pizza
|
||||
|
||||
|
||||
def pizza_tasting_menu():
|
||||
all_pizzas = []
|
||||
|
||||
margarita_pizza = make_pizza_reusable(num_pizzas=1, toppings=MARGARITA_TOPPINGS)
|
||||
all_pizzas.append(margarita_pizza)
|
||||
|
||||
mushroom_pizza = make_pizza_reusable(num_pizzas=2, toppings=MUSHROOM_TOPPINGS)
|
||||
all_pizzas.append(mushroom_pizza)
|
||||
|
||||
return all_pizzas
|
||||
51
src/italianfood/make_pizzas.py
Normal file
51
src/italianfood/make_pizzas.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
from italianfood.dough import PizzaDough
|
||||
from italianfood.ovens import bake_pizza
|
||||
|
||||
|
||||
class Pizza:
|
||||
dough: PizzaDough
|
||||
num_pizzas: int = 1
|
||||
is_ready: bool = False
|
||||
|
||||
def __init__(self, dough, num_pizza_balls):
|
||||
if num_pizza_balls < 1:
|
||||
raise ValueError("Number of pizza balls must be at least 1.")
|
||||
self.num_pizzas = num_pizza_balls
|
||||
self.dough = dough
|
||||
self.make_pizza_balls()
|
||||
|
||||
def make_pizza_balls(self):
|
||||
self.weight_per_pizza_ball = self.dough.total_weight / self.num_pizzas
|
||||
print(
|
||||
f"Each Pizza will be made out of {self.weight_per_pizza_ball} g dough.\n..."
|
||||
)
|
||||
print("Now imagine expert pizza tossing skills!\n...")
|
||||
return self
|
||||
|
||||
def add_toppings(self, toppings):
|
||||
self.toppings = toppings
|
||||
print(f"Adding {self.toppings} to pizza(s).\n...")
|
||||
return self
|
||||
|
||||
|
||||
def make_margherita_pizza(num_pizzas: int = 1):
|
||||
total_flour_weight = 180 * num_pizzas
|
||||
total_water_weight = 126 * num_pizzas
|
||||
total_salt_weight = 2 * num_pizzas
|
||||
total_yeast_weight = 1 * num_pizzas
|
||||
|
||||
dough = PizzaDough(
|
||||
flour_weight=total_flour_weight,
|
||||
water_weight=total_water_weight,
|
||||
salt_weight=total_salt_weight,
|
||||
yeast_weight=total_yeast_weight,
|
||||
)
|
||||
|
||||
toppings = ["tomato sauce", "mozzarella cheese", "fresh basil"]
|
||||
|
||||
pizza = Pizza(dough=dough, num_pizza_balls=num_pizzas)
|
||||
pizza.add_toppings(toppings)
|
||||
|
||||
baked_pizza = bake_pizza(pizza)
|
||||
|
||||
return baked_pizza
|
||||
7
src/italianfood/ovens.py
Normal file
7
src/italianfood/ovens.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
def bake_pizza(pizza, baking_time=2, temperature=450):
|
||||
# just pretend there is some complicated code
|
||||
print(
|
||||
f"The Pizza was baked for {baking_time} min at {temperature} C. It is now ready!\n..."
|
||||
)
|
||||
pizza.is_ready = True
|
||||
return pizza
|
||||
Loading…
Add table
Add a link
Reference in a new issue