feat: Semaine 8
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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.")
|
||||
Reference in New Issue
Block a user