Как я могу принять вход от пользователя и может создать всю базу данных в классе и инвентаризации - PullRequest
0 голосов
/ 09 марта 2020

класс Продукт: def init (self, name, id, price, number): self.name = имя self.id = id self.price = цена self.quantity = количество

инвентаризация классов (): def init (self): self.product_list = []

def add_product(self):
    name = input("Enter name of product: ")
    id = int(input("Enter the id: "))
    price = int(input("Enter the price: "))
    quantity = int(input("Enter quantity: "))
    self.product_list.append(Product(name,id,price,quantity))
    return self.product_list

def display(self):
    for product in self.product_list:
        print(product.name, product.id, product.price, product.quantity)

def inventory_value(self):
    for product in self.product_list:
        return sum(product.price * product.quantity)

Inventory.add_product ('')

product1 = Product («одежда», 1280 500,2) печать (product1.name, product1.id, product1.price, product1.quantity)

Inventory.add_product («имя, идентификатор, цена, количество»)

печать (инвентарь)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...