Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
767 B
7
Indexable
class Item:
    #constructor
    def __init__(self,name,price,quantity):
        self.name = name
        self.price = price
        self.quantity =  quantity

    def __str__(self):
        return f"name: {self.name},price:{self.price},quantity:{self.quantity}"

class Inv_management:
    def __init__(self):
        # create a default inventery
        self.inventery = [
            Item("Item1", 10.99, 50),
            Item("Item2", 5.99, 30),
            Item("Item3", 2.49, 100),
            Item("Item4", 7.99, 20),
            Item("Item5", 15.49, 10)
        ]
        self.run()

    def show_inv(self):
        print("Inventery")
        for value in self.inventery:
            print(value)
        print()

    def add_item