2025-plovdiv-ODD/materials/make_pizzas_ruff_demo.py
2025-09-22 15:24:21 +03:00

66 lines
1.7 KiB
Python

import numpy as np
from italianfood.dough import PizzaDough
from italianfood.ovens import bake_pizza
pizzaName = "Hello pizza"
class Pizza:
dough: PizzaDough
num_pizzas: int = 1
is_ready: bool = False
some_array: np.ndarray | None = None
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
import pandas
df = pandas.DataFrame(
{"col_a": [i for i in range(20)], "col_b": [j for j in range(20, 40)]}
)
df.drop(columns="col_b", inplace=True)