Files
gauvainboiche 3315cb2336 feat: Semaine 8
2026-05-11 09:25:19 +02:00

21 lines
559 B
Python

from dataclasses import dataclass
@dataclass
class Dish:
id: int
name: str
price: float
description: str = ""
is_available: bool = True
def with_new_price(self, new_price: float) -> 'Dish':
return Dish(
id=self.id,
name=self.name,
price=new_price,
description=self.description,
is_available=self.is_available
)
plat_01 = Dish(id=1, name="Spaghetti Carbonara", price=12.99, description="Classic Italian pasta dish with eggs, cheese, pancetta, and pepper.")