Project structure and classes

Project structure and classes created and initialized
This commit is contained in:
2026-06-01 20:12:20 +02:00
parent 6f4c037f54
commit 0e9d343b1e
11 changed files with 55 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
class Item:
def __init__(self, id, name, price) -> None:
self.id = id
self.name = name
self.price = float(price)
def to_json(self):
return {"id": self.id, "name": self.name, "price": self.price}
@staticmethod
def from_json(data):
return Item(data["id"], data["name"], data["price"])