Class Library
Class Library
self.title = title
self.author = author
self.publication_year = publication_year
self.price = price
self.quantity = quantity
def display_info(self):
print(self.title, "by", self.author, "was published in", self.publication_year, ",this is the price",
self.price, "and we have this", self.quantity, "amount")
def is_old(self):
print("old")
else:
print("not old")
self.quantity -= quantity
return True
else:
return False
book1.display_info()
book2.display_info()
book1.is_old()
book2.is_old()
inventory = {}
def add_book():
inventory[name] = book
print(title,"added to inventory.")
def view_book():
if not inventory:
print("inventory is empty.")
def buy_book():
return
book = inventory[title]
else:
print("purchase failed.")
else:
def main():
while True:
print("4. exit")
if choice == "1":
add_book()
view_book()
buy_book()
print("exiting... goodbye!")
break
else:
main()