Skip to content

Commit 6d74aeb

Browse files
authored
Update models.py
add dataclass
1 parent a932434 commit 6d74aeb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Python_part_3/homework/models.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
from dataclasses import dataclass
2+
3+
4+
@dataclass
15
class Product:
26
name: str
37
price: float
48
description: str
59
quantity: int
610

7-
def __init__(self, name, price, description, quantity):
8-
self.name = name
9-
self.price = price
10-
self.description = description
11-
self.quantity = quantity
1211

1312
def check_quantity(self, quantity) -> bool:
1413
if self.quantity >= quantity:

0 commit comments

Comments
 (0)